Vue安装成功后,在Style中使用,但是出现以下报错
页面出现的
Failed to compile.
./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-582df0cc","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/views/HelloWorld.vue
Module build failed: TypeError: this.getResolve is not a function
at Object.loader (D:\A-SoftwarePath\Environment\Vue+Element\kitty-ui\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-582df0cc","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/views/HelloWorld.vue 4:14-375 13:3-17:5 14:22-383
@ ./src/views/HelloWorld.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
npm内出现的
基本上都是sass-loader的版本过高导致的编译错误,所需要降低版本
解决办法:cd到项目文件里面运行下面
npm uninstall sass-loader(卸载当前版本)
npm install sass-loader@7.0.3 --save-dev
如果还出现问题提示node-sass未安装或未存在,可以在安装一遍node-sass就OK了