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


当前回答


**只需执行:** npm rebuild node-sass——force



If the above for some reason didn't work out for you, try this:

删除“node_modules”下的“node-sass”文件夹 npm安装


在我的例子中,它也找不到Python。

以下步骤解决了该问题(Windows):

npm rebuild node-sass --force
-- cannot find python.exe, if you have Python installed, add it to your path:
set PYTHON=C:\Python27\Python.exe
-- else: download python "Windows x86-64-MSI" installer from https://www.python.org/downloads/release/python-2714/
-- install python
-- at installation start check: add env variable to path
-- after successfull installation:
npm rebuild node-sass --force
-- finished successfully

其他回答

您可能有一个与当前版本不同的节点版本构建。尝试运行这些命令,应该可以解决问题。

npm cache clean --force &&  
rm -rf node_modules &&  
rm -rf package-lock.json &&  
npm i

运行以下命令,它对我来说工作得很好。

安装NPM node-sass

NPM重建node-sass

NVM使用10.16.3

node_modules node-sass /只/节点安装js。

Ng发球——投票=2000

我通过将JAVA_HOME从x86更改为x64来解决这个问题。Maven在x86上运行,但node使用x64。删除/node和/node_modules并重新构建。

这招对我很管用: 纱线添加—force node-sass@4.14.1或纱线添加—force node-sass

我也有同样的问题。我在这里找不到任何合适的解决方案,所以我找到了自己的:

受到@ robb - scott解决方案和其他建议的启发,我们可以安装两个版本的Node.js,我去了C:\Program Files (x86)\nodejs,发现除了VS默认安装之外,我还安装了一个Node.js版本。

我的解决办法很简单:

进入工具>选项>项目和解决方案> Web包管理>外部Web工具 单击添加一个条目(右上角按钮块的最左边) 输入C:\Program Files (x86)\ nodejs,按Enter确认 把它放在清单的最上面 享受

可能Node.js在PATH变量中没有设置好,但这是我的工作非常快速的解决方案,我的2美分:)