无法使用 npm 安装 sass-loader
could not install sass-loader using npm
当我使用此命令在我的项目中安装 sass-loader 时:
npm install sass-loader@12.4.0
显示错误如下:
➜ 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.
为什么会这样?我应该怎么做才能解决这个问题?是否可以自动解决和修复依赖关系?实在不知道该用哪个版本,也不知道依赖矩阵,能不能让npm找到最合适的依赖,自动安装修复?
我在 dev.to
上找到了解决方案
这对我有用
npm install -D sass-loader@^10 sass
当我使用此命令在我的项目中安装 sass-loader 时:
npm install sass-loader@12.4.0
显示错误如下:
➜ 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.
为什么会这样?我应该怎么做才能解决这个问题?是否可以自动解决和修复依赖关系?实在不知道该用哪个版本,也不知道依赖矩阵,能不能让npm找到最合适的依赖,自动安装修复?
我在 dev.to
上找到了解决方案这对我有用
npm install -D sass-loader@^10 sass