Skip to content

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

@brettins

Description

@brettins

Is there an existing issue for this?

  • I have searched the existing issues

This is a CLI Docs Problem, not another kind of Docs Problem.

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentationdocumentation related issueNeeds Triageneeds review for next steps

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions