记录vue-cil安装scss时遇到的问题
执行npm install scss安装scss,但是报错@ ./node_modules/vue-style-loader!./node_modules/css-loader?{“sourceMap”:true}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,“id”:“data-v-7ba5bd90”,“scoped”:fal
执行npm install scss
安装scss,但是报错
@ ./node_modules/vue-style-loader!./node_modules/css-loader?{“sourceMap”:true}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,“id”:“data-v-7ba5bd90”,“scoped”:false,“hasInlineConfig”:false}!./node_modules/sass-loader/dist/cjs.js?{“sourceMap”:true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue 4:14-357 13:3-17:5 14:22-365
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
能看出来是少安装了依赖,于是执行 npm install sass-loader --save-dev
但是报错
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vue-wheel@1.0.0
npm ERR! Found: webpack@3.12.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^3.6.0" 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! dev sass-loader@"*" 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/liuyifan/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/liuyifan/.npm/_logs/2022-02-14T13_02_29_493Z-debug.lo
看起来八成是版本问题,看到网上说npm 版本7要比版本6严格,所以决定把npm 降级到版本6,执行npm install npm@6 -g
,npm成功降级,成功安装。但是依然会报错this.getOptions is not a function
八成还是版本问题,卸载sass-loader执行npm uninstall sass-loader
然后安装指定版本的sass-loader@7.3.1和node-sass@4.14.1
npm install sass-loader@7.3.1 --save-dev
npm install node-sass@4.14.1 --save-dev
成功!
更多推荐
所有评论(0)