Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] installing a dependency in a package with a peer dependency changes the peerDependencies field #3096

Closed
targos opened this issue Apr 18, 2021 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@targos
Copy link
Contributor

targos commented Apr 18, 2021

Current Behavior:

If you have a package with something in peerDependencies and then install that something in the same package as a devDependency, the peerDependencies field is changed and the dependency is added to package.json, but it inherits the semver string that the peer dependency had.

Expected Behavior:

Installing a dev dependency should do the same change to the package.json, whether that dependency is already in peerDependencies or not.

Steps To Reproduce:

echo '{ "peerDependencies": { "typescript": "*" } }' > package.json
npm i -D typescript
cat package.json
{"peerDependencies":{"typescript":"^4.2.4"},"devDependencies":{"typescript":"*"}}

Environment:

  • OS: macOS
  • Node: 15.14.0
  • npm: 7.10.0
@targos targos added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Apr 18, 2021
@wraithgar
Copy link
Member

Closing this as a duplicate of #2647, as it's the same root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants