Search code examples
javascriptsass-loader

could not install sass-loader using npm


when I using this command to install sass-loader in my project:

npm install sass-loader@12.4.0

show error like this:

➜  crx-selection-translate git:(6.x-master) ✗ npm install sass-loader@12.4.0
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: webpack@1.15.0
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^1.13.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^5.0.0" from sass-loader@12.4.0
npm ERR! node_modules/sass-loader
npm ERR!   sass-loader@"12.4.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/xiaoqiangjiang/.npm/eresolve-report.txt for a full report.

why did this happen? what should I do to fix this problem? is it possible to auto resolve and fix the dependencies? I really did not know which version should I use, and I still did not know the dependencies matrix, is it possible to let the npm to find the most suitable dependencies and auto install and fix?


Solution

  • I found a solution on dev.to

    This worked for me

    npm install -D sass-loader@^10 sass