Skip to content

[BUG] Can't install new dependencies into workspace package with workspace dependencies #2035

Closed
@justinfagnani

Description

@justinfagnani

Current Behavior:

npm i some-package fails if run in a workspace package that depends on another workspace package. The error is that the other workspace package is not found in the registray:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/other-package - Not found

Here other-package is a private package in the same workspace.

You also can't add a dependency manually and run npm i in the root of the workspace due to #1984

So there appears to be no way to add new dependencies in a workspace, aside from deleting the top-level node_modules folder and package-lock.

Expected Behavior:

npm i inside a workspace package should update the package.json file and install the dependency.

Steps To Reproduce:

  1. In a workspace with packages a and b, with a depending on b
  2. Do an initial install at the workspace root to set everything up
  3. cd to packages/a
  4. Run npm i {some-package}
  5. See error...

Environment:

  • OS: macOS
  • Node: 15
  • npm: 17.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancementnew feature or improvementRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions