ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

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

2022-08-13 11:31:13  阅读:193  来源: 互联网

标签:node sass modules js cjs loader


Failed to compile.

./src/styles/index.scss (./node_modules/_css-loader@1.0.1@css-loader??ref--8-oneOf-3-1!./node_modules/_postcss-loader@3.0.0@postcss-loader/src??ref--8-oneOf-3-2!./node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js??ref--8-oneOf-3-3!./src/styles/index.scss)
Module build failed (from ./node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js):
Error: Missing binding C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\_node-sass@4.14.1@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\_node-sass@4.14.1@node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\_node-sass@4.14.1@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\_sass-loader@7.3.1@sass-loader\dist\index.js:198:10)
    at Object.loader (C:\extend\work\frontEndProject\vue-admin-template-custom\node_modules\_sass-loader@7.3.1@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
来源: https://www.cnblogs.com/kinome/p/16582655.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有