webpack报错5
关于sass-loader与node-sass使用打包时报错问题
报错代码:
ERROR in ./src/css/1.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/css/1.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Node Sass version 5.0.0 is incompatible with ^4.0.0.
at getRenderFuncFromSassImpl (C:\Users\lenovo\Desktop\js\08-vue\05-前端工程化\mywebpack\node_modules\sass-loader\dist\index.js:165:13)
at Object.loader (C:\Users\lenovo\Desktop\js\08-vue\05-前端工程化\mywebpack\node_modules\sass-loader\dist\index.js:79:18)
@ ./src/css/1.scss 1:14-120
@ ./src/index.js
报错信息:
解决:
还是node-sass版本问题,报错信息提示node-sass版本过高,需要换成4.0+版本的:
先卸载原来的
npm uninstall node-sass
再下载对应版本
npm install node-sass@4.12.0 -D
最后成功打包。