-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
Attempting to use --workspace argument seems to bring back the issue described in
#3136
and supposedly fixed in
#8278
Example using PowerShell
npm run start --workspace=my_package -- "foo" -b "bar" -c "baz"
start
inside the package is defined as
node dist/cli.js
Results in
node dist/cli.js "foo" "bar"
- the "foo" argument is fine
- the "-b" option is missing but its value "bar" remains
- the "-c" option is removed completely
Sorry for a not more concrete example but this is happening in an internal project, I hope these examples are clear enough to recreate the situation.
For now a workaround for us is to run from the package folder.
Expected Behavior
In CLI
npm run start --workspace=my_package -- "foo" -b "bar" -c "baz"
start
inside the package is defined as
node dist/cli.js
Should result in
node dist/cli.js "foo" -b "bar" -c "baz"
Steps To Reproduce
- Have a monorepo with multiple packages
- Define a
start
script in the package.json of the package, make it call js code that reads CLI arguments - From the monorepo root, try to run the script using --workspace argument for npm
- Observe how arguments are passed to the package start script
Environment
- npm: 11.4.2
- Node.js: 24.3.0
- OS Name: Windows 11
- System Model Name:
- npm config:
npm error code ENOWORKSPACES
npm error This command does not support workspaces.
Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps