简体   繁体   English

无法使用 npm 安装 sass-loader

[英]could not install sass-loader using npm

when I using this command to install sass-loader in my project:当我使用此命令在我的项目中安装 sass-loader 时:

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?我真的不知道我应该使用哪个版本,我仍然不知道依赖关系矩阵,是否可以让 npm 找到最合适的依赖关系并自动安装和修复?

I found a solution on dev.to我在dev.to上找到了解决方案

This worked for me这对我有用

npm install -D sass-loader@^10 sass

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM