sass-loader 版本不兼容导致老项目起不来,重新构建失败的问题 Module build failed (from ./node_modules/_sass-loader@7.3.1@sass

2022/8/14 1:25:16

本文主要是介绍sass-loader 版本不兼容导致老项目起不来,重新构建失败的问题 Module build failed (from ./node_modules/_sass-loader@7.3.1@sass,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Failed to compile.

./src/styles/index.scss (./node_modules/[email protected]@css-loader??ref--8-oneOf-3-1!./node_modules/[email protected]@postcss-loader/src??ref--8-oneOf-3-2!./node_modules/[email protected]@sass-loader/dist/cjs.js??ref--8-oneOf-3-3!./src/styles/index.scss)
Module build failed (from ./node_modules/[email protected]@sass-loader/dist/cjs.js):
Error: Missing binding C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\[email protected]@node-sass\vendor\win32-x64-83\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 14.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 12.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
    at module.exports (C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\[email protected]@node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\[email protected]@node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at getDefaultSassImpl (C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\[email protected]@sass-loader\dist\index.js:198:10)
    at Object.loader (C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\[email protected]@sass-loader\dist\index.js:80:29)

 

如果是老项目,把node_module给直接删了,然后重新用yarn进行构建即可正常运行,

因为网上推荐的方法会叫你去用npm uninstall来卸载node-sass,但是会卡在idealtree的构建部分。

 

一劳永逸的方法:

node版本降级(重装)为:v14.16.0

npm install --global yarn

然后项目目录下直接输入yarn进行构建即可。


 



这篇关于sass-loader 版本不兼容导致老项目起不来,重新构建失败的问题 Module build failed (from ./node_modules/_sass-loader@7.3.1@sass的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程