ERROR Failed to compile with 8 errors 上午8:54:34
error in ./src/styles/index.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding E:\BaiduNetdiskDownload\tool\vue-admin-template-master\node_modules\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 10.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 (E:\BaiduNetdiskDownload\tool\vue-admin-template-master\node_modules\node-sass\lib\binding.js:15:13)
at Object.<anonymous> (E:\BaiduNetdiskDownload\tool\vue-admin-template-master\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.sassLoader (E:\BaiduNetdiskDownload\tool\vue-admin-template-master\node_modules\sass-loader\lib\loader.js:24:22)
@ ./src/styles/index.scss 4:14-203 14:3-18:5 15:22-211
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:9528 (webpack)/hot/dev-server.js ./src/main.js
大概错误是
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 10.x
就是sass不适用Node.js 14.x的版本
查看package.json
查看node与node-sass版本对应关系
https://www.npmjs.com/package/node-sass
从图可以看到Node14对应sass4.14+
第一种解决方案,npm中安装
首先改掉package.json中对应的node-sass的版本号,再执行以下两条命令
npm install -g node-gyp
npm install node-sass
第二种
执行下面两条命令
npm rebuild node-sass
npm update