Unresolved dependency peer webpack@"^4.0.0" from css-loader@2.1.1

Viewed 344

I was trying to run a react project. React and Node version Installed:

  • React: 18.1.0
  • Node: 16.15.1
  • Package manager: npm v 8.12.1
  • OS: macOS Catalina 10.15.7

    Any help in resolving the errors will be appreciated!
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: cbioportal-frontend@3.3.182
npm ERR! Found: webpack@5.55.1
npm ERR! node_modules/webpack
npm ERR!   webpack@"^5.55.1" from the root project
npm ERR!   peer webpack@"*" from bootstrap-loader@1.3.3
npm ERR!   node_modules/bootstrap-loader
npm ERR!     bootstrap-loader@"^1.2.0-beta.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from css-loader@2.1.1
npm ERR! node_modules/css-loader
npm ERR!   css-loader@"^2.1.1" from the root project
npm ERR!   peer css-loader@"*" from bootstrap-loader@1.3.3
npm ERR!   node_modules/bootstrap-loader
npm ERR!     bootstrap-loader@"^1.2.0-beta.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.```
2 Answers

I tried this and now it is working for me first check the version on the node by executing this command node -v and if you don't have this node versions v12.22.12 install it by executing this command nvm install 12.22.12 and then use this node only by executing this command nvm use 12.22.12 and then restart your terminal(close all terminal) and then start

Based on the error message, there is dependency conflict between css-loader@^2.1.1" and webpack@^4.0.0.

Try npm uninstall --save-dev css-loader webpack to uninstall the dependencies entirely.

Then reinstall them with npm install --save-dev css-loader webpack.

Hopefully, there won't be any dependency conflict with the latest versions, but if so, try npm install --legacy-peer-deps

Related