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] unable to resolve dependency tree #2119

Closed
lornally opened this issue Nov 4, 2020 · 11 comments
Closed

[BUG] unable to resolve dependency tree #2119

lornally opened this issue Nov 4, 2020 · 11 comments
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

@lornally
Copy link

lornally commented Nov 4, 2020

there is another bug, but has been closed.

Current Behavior:

npm install --save-dev webpack-dev-server

output:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: webpack@5.3.2
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^5.3.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from webpack-dev-middleware@3.7.2
npm ERR! node_modules/webpack-dev-middleware
npm ERR!   webpack-dev-middleware@"^3.7.2" from webpack-dev-server@3.11.0
npm ERR!   node_modules/webpack-dev-server
npm ERR!     dev webpack-dev-server@"^3.11.0" 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 /Users/bergman/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bergman/.npm/_logs/2020-11-04T06_31_48_517Z-debug.log

Environment:

  • OS: macos 10.15.7
  • Node: 15.0.1
  • npm: 7.0.3
@lornally lornally 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 Nov 4, 2020
@ljharb
Copy link
Contributor

ljharb commented Nov 4, 2020

What happens with npm v7.0.8?

@lornally
Copy link
Author

lornally commented Nov 4, 2020

What happens with npm v7.0.8?

how can i install it? i install node, the npm is 7.0.3, how can i update it to 7.0.8?

@jonleopard
Copy link

@lornally You can grab the latest version of npm by running npm install npm@latest -g. After that's finished, run npm -v to confirm you have v7.0.8 installed.

@nlf
Copy link
Contributor

nlf commented Nov 4, 2020

we haven't actually tagged npm 7 as latest yet, but npm install -g npm@7 should do the trick for you

@billyjanitsch
Copy link

This seems like expected behavior. You have webpack@5.3.2 installed and you're trying to install webpack-dev-server@3.11.0 which transitively peer-depends on webpack@^4.0.0. These webpack ranges are incompatible, as the error mentions.

You can fix it by using webpack@4 instead of webpack@5. webpack-dev-server@3 is not compatible with webpack@5.

(IMO, npm's output here is not very friendly. It's nice that it identifies all of the relevant packages, but if I didn't know much about peer dependencies, I could imagine being quite confused about what's wrong and what to do next. The message doesn't explicitly mention that it's a peer dependency issue -- it says "peer" but it also says "dev" and many other things -- and "fix the upstream dependency conflict" is not actionable.)

@isaacs
Copy link
Contributor

isaacs commented Nov 11, 2020

Working as designed, and better error messaging and handling in latest npm v7.

@isaacs isaacs closed this as completed Nov 11, 2020
@mvyunko
Copy link

mvyunko commented Nov 14, 2020

i had the same prob

npm install npm@latest -g
then
npm install webpack-dev-server --save-dev

working for me

@darcyclarke darcyclarke added this to the OSS - Sprint 19 milestone Nov 16, 2020
@mihailthebuilder
Copy link

mihailthebuilder commented Nov 20, 2020

@nlf 's solution doesn't work for me but @mvyunko 's does. The latter downgrades npm from version 7 to 6 however.

@hosseinGanjyar
Copy link

hosseinGanjyar commented Nov 21, 2020

I had same problem and have done these steps:

  1. uninstall & install nodejs
  2. npm install npm
  3. npm install webpack-dev-server --save-dev

@tienphamminh
Copy link

retry this command with --force:
npm install webpack-dev-server --save-dev --force

@Moise10
Copy link

Moise10 commented Aug 7, 2022

// This solved my problem
npm config set legacy-peer-deps true

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

13 participants