Skip to content

[BUG] npm install removes peer dependency #3280

@JoshMcCullough

Description

@JoshMcCullough

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

npm i --save ... removes related peer dependency.

Expected Behavior

npm i --save ... does not remove peer dependencies.

Steps To Reproduce

Existing package.json:

  "dependencies": {
    "@my-org/my-pkg": "^1.0.0"
  },
  "peerDependencies": {
    "@my-org/my-pkg": "^1.0.0",
    "some-other-pkg": "^2.3.4"
  }

Running npm i --save @my-org/my-pkg@1.0.1 results in the following package.json:

  "dependencies": {
    "@my-org/my-pkg": "^1.0.1"
  },
  "peerDependencies": {
    "some-other-pkg": "^2.3.4"
  }

Note that the peer dependency "@my-org/my-pkg": "^1.0.1" was removed during install.

Environment

  • OS: Manjaro 21.0.5
  • Node: 12.19.1
  • npm: 7.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 releaseWontfixthis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions