michelle3000
michelle3000

Reputation: 1

dependency conflict -- node

this is my first time posting a question on stack overflow so please go easy on me :)

i am trying to spin up an old project and am running into some dependency conflicts and am quite lost. when i first run npm install i get a couple errors — see below.

 code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^2.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from [email protected]
npm ERR! node_modules/css-loader
npm ERR!   dev css-loader@"2.1.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.

i run the command(s) they recommend and get a litany of warnings that i need to update old dependencies (which i expected), so i try and run npm update and the initial error (photo above) happens again.

i then read through this post which has very similar issues but to be honest, i think i'm getting incredibly confused.

i'm getting mad tripped up on this so any help will be incredibly appreciated.

Upvotes: 0

Views: 1226

Answers (1)

Trott
Trott

Reputation: 70055

Based on the error message, you are seeing a dependency conflict between css-loader@^2.1.1" and webpack@^2.7.0. I was able to replicate this problem in npm@7 which has stricter dependency checking than previous versions of npm. As a workaround run npm install with the --legacy-peer-deps flag and it will use the older, less-strict peer dependency resolution.

Once you have your project installed and working, it would be a very good idea to update your dependencies. I hope you have good tests. css-loader is (at the time of this writing) at version 5.1.1. The last 2.x release was about 2 years ago. And webpack is currently at version 5.24.2. The last 2.x release for webpack was about 4 years ago.

Upvotes: 1

Related Questions