报错内容:
ERROR Failed to compile with 1 errors 17:55:06
error in ./src/views/Login.vue
Module build failed: Error: Node Sass version 8.0.0 is incompatible with ^4.0.0.
at getRenderFuncFromSassImpl (E:\Projects\vue-element\node_modules\sass-loader\dist\index.js:165:13)
at Object.loader (E:\Projects\vue-element\node_modules\sass-loader\dist\index.js:79:18)
@ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-26084dc2","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/Login.vue 4:14-370 13:3-17:5 14:22-378
@ ./src/views/Login.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
解决方法:
安装低版本scss以及其依赖(与我无效)
npm install sass-loader@7.3.1 --save-dev
css引入错误,将lang=”scss“,改为lang=”css“,再次运行项目成功。
<style lang="css" scoped>
//内容
</style>