fix: much clearer npx 'canceled' error#6642
Conversation
| if (yes === false) { | ||
| throw new Error('canceled') | ||
| // Error message lists missing package(s) when process is canceled | ||
| throw new Error(`npx canceled due to missing packages and no YES option: ${JSON.stringify(missingPackages)}`) |
There was a problem hiding this comment.
| throw new Error(`npx canceled due to missing packages and no YES option: ${JSON.stringify(missingPackages)}`) | |
| /* eslint-disable-next-line max-len */ | |
| throw new Error(`npx canceled due to missing packages and no YES option: ${JSON.stringify(missingPackages)}`) |
|
Can you please add the max-len override for the thrown error, then run |
|
Thanks for the feedback, we made the appropriate changes that you suggested! |
|
What does "no YES option" mean? How can you correct this if you encounter this error? What is the option you need to add? |
|
The “no YES option” is what If you want your command to execute, instead of using |
Summary
Currently, when running npx --no-install on a package that is not installed will return a vague error message that says, “canceled.”
Added accompanying tap test to ensure the expected error is outputted.
This solution gives the error message more clarity to make debugging easier.
Testing
Reproduce Original Error:
npx --no-install <missing_package>Please Note:
<missing_package>is either not installed or in pathTap Test (exec.js only)
node . run test test/lib/commands/exec.jsRun entire test:
node . run testAlias Test
alias localnpx="node /workspaces/cli/bin/npx-cli.js"localnpx --no-install esbuildReferences
Fixes #6215