npm运行报错:Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 16.x

npm run dev运行项目后报错,错误信息为:

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 16.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 16.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.


错误原因为:node-sass和node版本不兼容。

解决办法:

npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/

执行从新安装node-sass,安装成功后,从新运行项目即可。

另外一种解决办法

npm uninstall node-sass
npm install node-sass

个人比较推荐第一种方式,国内环境使用淘宝镜像。

六月初字帖坊小程序 你想要的字帖模板及工具,这里都有!