Vue scss报错

报错信息

Failed to compile.

./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
Module build failed: TypeError: this.getResolve is not a function
    at Object.loader (D:\project\front\my-project\node_modules\sass-loader\dist\index.js:52:26)
 @ ./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

解决方法:

1.切换镜像文件地址

npm install -g mirror-config-china --registry=http://registry.npm.taobao.org

2.安装sass-loader、node-sass

npm install sass-loader node-sass -D

3.将package.json文件中sass-loader版本改为7.3.1

"sass-loader": "^7.3.1",

4.重新安装依赖

npm install

5.启动项目

npm run dev

你可能感兴趣的:(Vue,vue,scss)