我有问题构建一个应用程序,因为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,这两者都没有解决问题。什么好主意吗?


当前回答

我在Linux Mint中做了所有这些:

删除node_modules 运行npm install 运行npm rebuild node-sass

但是它并没有修复这个问题,仍然得到关于node-sass的错误。

我尝试再次运行命令重建node-sass与sudo即sudo npm重建node-sass,它终于工作了!

其他回答

就我的具体情况而言,上述答案都不起作用。那么它的工作原理是:

rm -rf node_modules 
rm -rf /tmp/* 
rm -rf /root/.npm/node-sass 
npm uninstall --save node-sass 
npm cache clean --force 

NPM缓存验证检查缓存中是否没有剩余内容

npm install

虽然我没有试图重现序列,但这是上述工作的组合。 此外,你还可以尝试:

NPM install node-sass或NPM install node-sass -g

npm rebuild node-sass
npm install bindings

我在Node v7.4.0 Current(最新功能)中遇到了同样的问题。

在这里阅读了一些内容,并将Node降级为v6.9.4 LTS,在运行npm rebuild Node -sass后,它下载了二进制文件,一切都开始工作了。

从https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node下载二进制文件 下载完成。 二进制文件保存到D:\xxx\xxx-xxx\node_modules\node-sass\vendor\win32-x64-48\binding.node 将二进制文件缓存到C:\Users\user\AppData\Roaming\npm-cache\node-sass\3.13.1\win32-x64-48_binding.node

这对我很有效 删除node_modules,然后从IDE恢复包,然后npm重建node-sass

在删除node_modules或清理缓存(这会花费时间)之前,尝试运行

NPM重建node-sass——force

在项目文件夹中。就像我的一样,你的问题得到解决的几率很高。如果不成功,试试下面的方法:

npm cache clean --force 
rm -rf node_modules 
npm install 
npm rebuild node-sass

npm start

我也有同样的问题

    throw new Error(errors.missingBinary());
    ^

Error: Missing binding /path/to/project/node_modules/node-sass/vendor/linux-x64-47/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 5.x

Found bindings for the following environments:
  - Linux 64-bit with Node 0.10.x
  - Linux 64-bit with Node.js 5.x

这是因为我用不同的nodejs版本安装了npm, 尝试删除node_modules文件夹安装和启动

cd your_project
rm -rf node_modules
npm install
npm start or gulp or whatever

如果你正在使用nvm do

nvm use stable // or your favorite version
// remove node_module directory
npm install
npm start or gulp or whatever