2021-10-16 乐帮网
webpack nodejs
nmp run build
ERROR in ./static/sass/element-variables.scss
Module build failed: ModuleBuildError: Module build failed: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.
at getRenderFuncFromSassImpl (E:\code\bak\TachographsApp\node_modules\sass-loader\dist\index.js:165:13)
at Object.loader (E:\code\bak\TachographsApp\node_modules\sass-loader\dist\index.js:79:18)
at E:\code\bak\TachographsApp\node_modules\webpack\lib\NormalModule.js:195:19
at E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at runSyncOrAsync (E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:143:3)
at iterateNormalLoaders (E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (E:\code\bak\TachographsApp\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:40:15)
at E:\code\bak\TachographsApp\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:77:9
at E:\code\bak\TachographsApp\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
@ ./src/main.js 45:0-47
ERROR in ./static/sass/element-variables.scss
Module build failed: ModuleBuildError: Module build failed: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.
at getRenderFuncFromSassImpl (E:\code\bak\TachographsApp\node_modules\sass-loader\dist\index.js:165:13)
at Object.loader (E:\code\bak\TachographsApp\node_modules\sass-loader\dist\index.js:79:18)
at E:\code\bak\TachographsApp\node_modules\webpack\lib\NormalModule.js:195:19
at E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at runSyncOrAsync (E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:143:3)
at iterateNormalLoaders (E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at E:\code\bak\TachographsApp\node_modules\loader-runner\lib\LoaderRunner.js:205:4
at E:\code\bak\TachographsApp\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:70:14
at processTicksAndRejections (node:internal/process/task_queues:78:11)
@ ./static/sass/element-variables.scss
@ ./src/main.js
Build failed with errors.
网上分析也都对原因如下:
原因:node-sass 版本过高,卸载重装低版本
1、卸载:$ npm uninstall node-sass
2、安装:$ npm install node-sass@4.12.0
3、运行:$ npm run dev
做个简单的测试学习还可,真实项目中操作应该改成:
1、直接找到 package.json搜索 node-sass 改为:
"node-sass": "^4.14.1",
然后:
npm install node-sass@4.14.1
npm run build
恭喜你跳出这个坑又入另一个坑,我就是卸载了一个vs2017居然一连串导致出五六个莫名错误。修复难度一个比一个大。
可以查看右侧相关文章找到相关错误介绍。
关注我的微信公众号
在公众号里留言交流
投稿邮箱:1052839972@qq.com
庭院深深深几许?杨柳堆烟,帘幕无重数。
玉勒雕鞍游冶处,楼高不见章台路。
雨横风狂三月暮。门掩黄昏,无计留春住。
泪眼问花花不语,乱红飞过秋千去。
如果感觉对您有帮助
欢迎向作者提供捐赠
这将是创作的最大动力