cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Unable to update dependency and peer dependency at the same time

Open UziTech opened this issue 4 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When updating multiple dependencies at the same time by updating their version in package.json and running npm install The following error will be shown if one of the dependencies being updated is a peerDependency of another dependency that is being updated which has updated the peerDependency version.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @semantic-release/[email protected]
npm ERR! node_modules/@semantic-release/apm-config
npm ERR!   dev @semantic-release/apm-config@"^9.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @semantic-release/apm-config@"^9.0.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/semantic-release
npm ERR!   peer semantic-release@">=18.0.0" from @semantic-release/[email protected]
npm ERR!   node_modules/@semantic-release/apm-config
npm ERR!     dev @semantic-release/apm-config@"^9.0.1" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /tmp/renovate-cache/others/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/renovate-cache/others/npm/_logs/2021-09-22T03_55_08_332Z-debug.log

If one of the dependencies is updated first with the --force flag then the other dependency is updated without the --force flag it works fine.

Expected Behavior

installs dependencies

Steps To Reproduce

  1. Create new folder
  2. Run npm init -y
  3. Run npm i semantic-release@^17 @semantic-release/apm-config@^8
  4. Change versions in package.json to "semantic-release": "^18.0.0" and "@semantic-release/apm-config": "^9.0.0"
  5. Run npm i

Environment

  • OS: Windows 10
  • Node: 14.17.6
  • npm: 7.24.0

UziTech avatar Sep 22 '21 05:09 UziTech

Reproduction without manual version change in package.json:

npm init -y
npm i lexical @lexical/react
npm i --save-exact [email protected] @lexical/[email protected]

targos avatar Jan 22 '24 07:01 targos