-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I am using NPM workspaces. I am running a command of the format:
npm exec --no --workspace=my-workspace --package @graphql-codegen/cli -- graphql-codegen --config codegen.js
It fails with a rather terse npm ERR! canceled
.
This is related to a previous issue #2826. The bug was partially resolved by @ruyadorno in npm/libnpmexec#2. However, looking at the commit, it seems that the fix was only applied inside the if (needPackageCommandSwap)
block. This only executes if no --package
option has been specified.
If --package
is specified, then the code falls through to https://github.com/npm/libnpmexec/blob/a9423e441b914571ec18ad8a4496a3ecf2f500e2/lib/index.js#L153. It will then try to install the package (even though it's already available locally). However, if --no[-install]
is specified, it will simply throw an exception instead.
Expected Behavior
The npm exec
and npx
commands should work when used in a workspace with the --package
and --no[-install]
options.
Steps To Reproduce
No response
Environment
- OS: Windows
- Node: 16.4.0
- npm: 7.19.1