cli icon indicating copy to clipboard operation
cli copied to clipboard

[DOCS] workspace: protocol documented but throws EUNSUPPORTEDPROTOCOL in npm 11.6.4

Open brettins opened this issue 3 weeks ago • 0 comments

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

  1. Create a monorepo with workspaces:
{
  "name": "test-monorepo",
  "workspaces": ["packages/a", "packages/b"]
}
  1. Create packages/a/package.json and packages/b/package.json with valid package names
  2. Run: npm install b@workspace:* -w a
  3. 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

brettins avatar Dec 09 '25 01:12 brettins