[BUG] ERESOLVE - peer dependency conflicts by packages which should get replaced
Nobody has claimed this yet.
- 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
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
I have the following package.json structure:
{
"name": "reproduction",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {},
"devDependencies": {
"@storybook/react-vite": "8.4.7",
"@storybook/test": "8.4.7",
"storybook": "8.4.7"
}
}
Running npm install correctly installs all packages. I want to update now manually the packages to their latest version 8.5.1.
When I run npm install, I get the following error message:
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: reproduction@0.0.0
npm error Found: @storybook/react-vite@8.4.7
npm error node_modules/@storybook/react-vite
npm error dev @storybook/react-vite@"8.5.1" from the root project
npm error
npm error Could not resolve dependency:
npm error dev @storybook/react-vite@"8.5.1" from the root project
npm error
npm error Conflicting peer dependency: @storybook/test@8.5.1
npm error node_modules/@storybook/test
npm error peerOptional @storybook/test@"8.5.1" from @storybook/react-vite@8.5.1
npm error node_modules/@storybook/react-vite
npm error dev @storybook/react-vite@"8.5.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
I would appreciate any help. We have been debugging this for a long time, and we already cleaned up our peer-dependencies and transitive peer-dependencies so that they are correctly declared. But currently, we don't know how to continue. npm is also the only package manager that fails.
Expected Behavior
npm install doesn't fail after package update
Steps To Reproduce
- Create a project with the following package.json
{
"name": "reproduction",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {},
"devDependencies": {
"@storybook/react-vite": "8.4.7",
"@storybook/test": "8.4.7",
"storybook": "8.4.7"
}
}
npm install- Update manually the packages to their latest version
8.5.1:
{
"name": "reproduction",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {},
"devDependencies": {
"@storybook/react-vite": "8.5.1",
"@storybook/test": "8.5.1",
"storybook": "8.5.1"
}
}
npm install
Above error appears
Context:
"@storybook/test@8.5.1" has a peer dependency on storybook@^8.5.1
"@storybook/react-vite@8.5.1" has a peer dependency on storybook@^8.5.1 and @storybook/test@8.5.1
Environment
- npm: 10.9.0
- Node.js: 22.12.0
- OS Name: macOS Sonoma 14.4.1
- System Model Name: Macbook Pro
- npm config:
; "user" config from /Users/valentinpalkovic/.npmrc
//registry.npmjs.org/:_authToken = (protected)
//registry.yarnpkg.com/:_authToken = (protected)
registry = "https://registry.yarnpkg.com"
; node bin location = /Users/valentinpalkovic/.nvm/versions/node/v22.12.0/bin/node
; node version = v22.12.0
; npm local prefix = /Users/valentinpalkovic/Projects/vitejs-vite-izegxbtn
; npm version = 10.9.0
; cwd = /Users/valentinpalkovic/Projects/vitejs-vite-izegxbtn
; HOME = /Users/valentinpalkovic
; Run `npm config ls -l` to show all defaults.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the two package.json versions and npm 10.9.0 on Node.js 22.12.0, then inspect npm's peer-dependency resolution and ERESOLVE handling. Done means updating all three Storybook packages to 8.5.1 and running npm install without the reported dependency conflict.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100