Ensure npm run
is being called instead of npx run
#94
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue:
#93
Problem:
If you run
npm-run-all
usingnpx
(EX:npx npm-run-all clean build:dev test
), it will prompt you to installrunjs
if it is not already installed.Then, it will throw an error that looks something like this:

This is because running
npx npm-run-all
causesprocess.env.npm_execpath
to point tonpx
instead ofnpm
.The underlying command ends up something like
npx run clean
which will attempt to runrunjs
instead of running the npm scripts, and of course,clean
isn't a javascript file or anything thatrunjs
can do anything with, so that is why it throws.For reference, this is what it looks like when I intentionally run

runjs
in place ofnpm run
.If you look here at run.js, you can see the code that is being unintentionally ran by
npm-run-all
.I am pretty sure this problem is related to mysticatea#196. The error looks to be exactly the same, and on my machine,


yarn
aliases tonpx yarn
which would causeyarn
to throw an error wherenpm
would work fine.yarn:
npm:
Additional Information
I also modified how yarn is detected because I modified
npmPath
(which was how yarn was being detected previously). Before,isYarn
was false whennpx
was used in conjunction withyarn
. With these changes, it should actually detect yarn even if you runyarn
usingnpx
. (EXnpx yarn dev
)before:


after: