npm / npm/cli

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

Open
#3,782 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • 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: git-menu@3.2.9
npm ERR! Found: @semantic-release/apm-config@8.0.0
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: semantic-release@18.0.0
npm ERR! node_modules/semantic-release
npm ERR!   peer semantic-release@">=18.0.0" from @semantic-release/apm-config@9.0.1
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the package.json dependency versions and the listed npm install reproduction using Node 14.17.6 and npm 7.24.0. Trace the dependency-resolution behavior for simultaneous semantic-release and @semantic-release/apm-config updates; done means both updates install together without ERESOLVE, with regression coverage for the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.