Node Sass could not find a binding for your current environment

xiaoxiao2021-02-28  17

项目开发中,同一个项目多人开发时,可能会因为本地环境不同或者node版本不同,造成上述报错。解决方案如下:

(1)删除依赖

rm -rf node-modules

(2)更改本地环境

1、先运行: npm install -g node-gyp  2、然后运行:运行 npm install –global –production windows-build-tools 可以自动安装跨平台的编译器:gym

(3)重新安装依赖

cnpm i

(4)安装完依赖,如果还报错,重新构建本地node-sass

npm rebuild node-sass

一般情况下,执行完上述步骤后,问题基本解决。如果执行完上述步骤后,还有报错,则进行如下修改:

把node-sass版本前面的小三角删了,重新安装node-sass,之后重复步骤(4),执行即可。

转载请注明原文地址: https://www.6miu.com/read-2632401.html

最新回复(0)