首页 > 编程语言 >sass-loader 版本不兼容导致老项目起不来,重新构建失败的问题 Module build failed (from ./node_modules/[email protected]@sass

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

时间:2022-08-13 11:32:25浏览次数:139  
标签:node sass modules js cjs loader

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进行构建即可。


 

标签:node,sass,modules,js,cjs,loader
From: https://www.cnblogs.com/kinome/p/16582655.html

相关文章