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


当前回答

Windows 10 This was a fun one for me... In order to resolve it I had to do all of the following.. 1.) Apparently node-sass isn't supported by some of the more recent versions of Node.js so I had to Uninstall Node-v 12.14.1, and delete the nodejs directory in C:/Program Files. 2.) Reinstall a earlier version of Node (for me 10.16.2 worked). NOTE: I had initially downloaded the x86 version so if your System is x64 download the x64 verison... 3.) From here I had to delete my entire project and re-clone it. After this things ran fine.

其他回答

我也遇到过类似的问题,原因是我的机器上安装了两个版本的Node:一个是“全局”版本,另一个是项目级别的版本。 只有在Gulp构建在Node.js 4下运行时,Sass才能正确构建。x版本,因此请确保升级了您正在使用的Node版本。

PS:如果你完全删除项目中的node_modules文件夹并从头开始重新构建,npm将下载当前系统和节点版本的正确依赖项。

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

如果你读到这篇文章的结尾,但仍然没有工作。这可能有点傻,但试着验证一下你的文件夹中是否有以下文件:

.node-version .nvmrc

他们是事情不适合你的罪魁祸首。用节点版本更新文件,然后重新运行此线程中其他人提供的过程。它会起作用的。;)

只需要运行注释即可。

NPM重建node-sass

享受你的编码……

在“node_modules/node-sass/vendor/linux-x64-46/”目录下新建一个目录。 从https://github.com/sass/node-sass/releases下载文件 (linux-x64-59_binding.node)。 将其粘贴到node_modules/node-sass/vendor/linux-x64-46/重命名为binding.node