cli
cli copied to clipboard
[DOCS] workspace: protocol documented but throws EUNSUPPORTEDPROTOCOL in npm 11.6.4
Is there an existing issue for this?
- [x] I have searched the existing issues
This is a CLI Docs Problem, not another kind of Docs Problem.
- [x] This is a CLI Docs Problem.
Description of Problem
The workspaces documentation describes using the workspace: protocol to add a workspace as a
dependency of another workspace:
npm install b@workspace:* -w a
This will add an entry to workspace a's package.json like:
{
"dependencies": {
"b": "workspace:*"
}
}
However, running this command on npm 11.6.4 (latest) results in:
npm error code EUNSUPPORTEDPROTOCOL npm error Unsupported URL Type "workspace:": workspace:*
Steps to reproduce
- Create a monorepo with workspaces:
{
"name": "test-monorepo",
"workspaces": ["packages/a", "packages/b"]
}
- Create packages/a/package.json and packages/b/package.json with valid package names
- Run: npm install b@workspace:* -w a
- Observe EUNSUPPORTEDPROTOCOL error
Potential Solution
Remove the workspace: syntax from the docs as this only applies to pnpm or yarn.
Affected URL
https://docs.npmjs.com/cli/v11/using-npm/workspaces