Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Execa crashing when the wrong version of readable-stream is installed #259

Closed
wants to merge 1 commit into from

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented May 20, 2019

Execa crashes when users have a specific dependency tree installed, which somehow resolves readable-stream to the wrong version:

> await execa('echo')
Thrown:
TypeError: spawned.all.destroy is not a function
    at destroy (/home/code/node_modules/gulp-execa/node_modules/execa/index.js:335:16)
    at /home/code/node_modules/p-finally/index.js:7:12
    at new Promise (<anonymous>

This is due to an old version of readable-stream being used. This is not an issue for most users, but I managed to trigger this in my own packages.

This only happens when readable-stream@2.2.* is used instead of readable-stream@2.3.*. readable-stream is used by merge-stream which we use for the all option.

merge-stream uses the semver range ^2.0.1 so this should not be a problem. However I somehow managed to have the wrong version installed inside my dependency tree, probably because of wrong deduping:

$ npm ls readable-stream
autoserver@0.5.0 /home/ether/code/autoserver
├─┬ ava@1.4.1
│ └─┬ chokidar@2.1.5
│   ├─┬ UNMET OPTIONAL DEPENDENCY fsevents@1.2.7
│   │ └─┬ UNMET OPTIONAL DEPENDENCY node-pre-gyp@0.10.3
│   │   └─┬ UNMET OPTIONAL DEPENDENCY npmlog@4.1.2
│   │     └─┬ UNMET OPTIONAL DEPENDENCY are-we-there-yet@1.1.5
│   │       └── UNMET OPTIONAL DEPENDENCY readable-stream@2.3.6 
│   └─┬ readdirp@2.2.1
│     └── readable-stream@2.2.7  deduped
├─┬ gulp@4.0.2
│ ├─┬ gulp-cli@2.2.0
│ │ └─┬ concat-stream@1.6.2
│ │   └── readable-stream@2.2.7  deduped
│ └─┬ vinyl-fs@3.0.3
│   ├─┬ glob-stream@6.1.0
│   │ ├─┬ ordered-read-streams@1.0.1
│   │ │ └── readable-stream@2.2.7  deduped
│   │ └── readable-stream@2.2.7  deduped
│   ├─┬ lazystream@1.0.0
│   │ └── readable-stream@2.2.7  deduped
│   ├─┬ lead@1.0.0
│   │ └─┬ flush-write-stream@1.1.1
│   │   └── readable-stream@2.3.6 
│   ├─┬ pumpify@1.5.1
│   │ └─┬ duplexify@3.7.1
│   │   └── readable-stream@2.2.7  deduped
│   ├── readable-stream@2.3.6 
│   ├─┬ through2@2.0.5
│   │ └── readable-stream@2.3.6 
│   └─┬ vinyl@2.2.0
│     └─┬ cloneable-readable@1.1.2
│       └── readable-stream@2.3.6 
├─┬ gulp-execa@0.3.1
│ └─┬ execa@1.0.0 (github:sindresorhus/execa#c8a53da6748885423f73812580afd59699b36e31)
│   └─┬ merge-stream@1.0.1
│     └── readable-stream@2.2.7  deduped
├─┬ gulp-shared-tasks@0.27.72
│ ├─┬ eslint-plugin-html@5.0.5
│ │ └─┬ htmlparser2@3.10.1
│ │   └── readable-stream@3.3.0 
│ ├─┬ gulp-prettier@2.1.0
│ │ └─┬ through2@3.0.1
│ │   └── readable-stream@2.2.7  deduped
│ └─┬ jscpd@2.0.15
│   └─┬ level@5.0.1
│     └─┬ level-packager@5.0.1
│       └─┬ levelup@4.0.1
│         └─┬ level-iterator-stream@4.0.1
│           └── readable-stream@3.3.0 
└─┬ mongodb@2.2.36
  └── readable-stream@2.2.7

npm install or removing package-lock.json does not fix readable-stream to the correct version.

The good news is that the latest version of merge-stream does not use readable-stream at all, so that fixes this bug. However that version is not published to npm yet (I have published an issue).

@ehmicky
Copy link
Collaborator Author

ehmicky commented May 23, 2019

Fixed by #264

@ehmicky ehmicky closed this May 23, 2019
@ehmicky ehmicky deleted the feature/fix-all-destroy-bug branch May 23, 2019 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant