我有问题构建一个应用程序,因为node-sass不断失败的错误。
binding /Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node出错
Node Sass无法找到当前环境的绑定:OS X 64位的Node 0.10.x
我试过跑步
npm rebuild node-sass
说
二进制很好;退出。
当运行node -v时,我得到v6.2.2
这与sass错误说的“Node 0.10.x”不同。我不明白为什么它会得到错误的版本。我也尝试删除node_modules文件夹并运行npm update或npm install,这两者都没有解决问题。什么好主意吗?
检查你的系统:你的系统是否有两个不同的Node.js安装?
如果通过nodejs安装node,默认安装目录为
C:\Program Files\nodejs
我的节点版本是6。Xx安装在这里。
检查VS External web tools目录
C:\Program Files (x86)\Microsoft Visual Studio\2017\企业\Web\External
我的节点版本是5。Xx安装在那里。
一种解决方法是:
备份C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External目录。
复制C:\Program Files\nodejs目录内容和
粘贴到
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\外部目录。
从解决方案中删除node_modules目录。
重新运行项目。
如果您得到错误消息,请重新运行项目第二次。
如果这样不行的话
从解决方案中删除node_modules目录。
注意:$是命令提示符
$ npm install
…
$ npm run build:dev
重新运行项目。
node-sass runs an install script to download the required binary. If there are no environment variables, .npmrc variables or process arguments set then the binary is determined by using the current process platform, architecture and Node ABI version. Therefore, if you run node install in one application and then try to run node-sass in an application with a different platform/architecture/ABI, the binary won't have been downloaded. The solution is to manually download the binary or to fix the binary version using an environment variable (SASS_BINARY_NAME) or a .npmrc variable (sass_binary_name)
你可以在node-sass\lib\extensions.js中的getBinaryPath函数中看到这个逻辑