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


当前回答

试着加上后缀——force

npm rebuild node-sass --force

其他回答

当你在工作站上运行Node.js的更新并且全局使用node-sass时,就会发生这种情况。

因此,您应该全局卸载node-sass

npm uninstall -g node-sass

然后你必须再次全局安装它

npm install -g node-sass

我也有同样的问题

gulpfile中有一个错误: E:\allapp\badshaindiancuisine\node_module\node-sass\vendor\win32-x64-46\binding.node Node Sass无法找到当前环境的绑定:带有Node.js 4.x的64位Windows 为以下环境找到绑定: - OS X 64位,Node.js 4.x

如何解决这个问题

通过进入项目文件夹,然后执行命令:

npm rebuild node-sass

还请记住将xxx重新命名。节点文件(在我的例子中是win32-x64-51)绑定。节点并粘贴到XXX文件夹(在我的例子中是win32-x64-51),

NPM重建node-sass——force

或者,如果你在容器中使用node-sass:

Docker exec <container-id> NPM rebuild node-sass——force

当node-sass没有当前操作系统的正确绑定时,会发生此错误。

如果你使用Docker,当你将node_modules直接添加到Dockerfile中的容器文件系统(或使用Docker卷挂载它们)时,通常会发生这种错误。

容器体系结构可能与当前的操作系统不同。例如,我在macOS上安装node-sass,但我的容器运行Ubuntu。

如果强制node-sass从容器内部重新构建,node-sass将下载容器操作系统的正确绑定。

查看我的复制案例了解更多。

我也有同样的问题

    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