我有问题构建一个应用程序,因为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_modules,然后从IDE恢复包,然后npm重建node-sass

其他回答

对于使用Visual Studio的用户:

目前正在为VS 2015, 2017, 2019, 2022工作(通过下面和/或这篇文章的回复)

任务运行器资源管理器无法加载任务

VS 2015

转到:工具>选项>项目和解决方案>外部Web工具

VS 2017(.3), VS 2019和VS 2022

>选项>项目和解决方案> Web包管理>外部Web工具(每个@nothrow)

在VS 2017, 2019, 2022,你还需要把$(PATH)放在$(VSINSTALLERDIR)\Web\External上面


重新排序,使$(PATH)在$(DevEnvDir)\Extensions\Microsoft\Web Tools\External之上


删除node_modules并运行npm install和npm rebuild node-sass没有任何作用。

在linux ubuntu 20.04上,我需要几个步骤,首先将节点降级到合适的版本,删除node_modules,运行yarn install,最后运行sudo yarn add node-sass@4.13.0——force。节点版本号10.0.0。 这是我唯一的工作方式。

在构建docker映像并试图在本地运行时,我遇到了同样的问题。你需要添加一个.dockerignore文件,内容如下: .DS_Store . .gitignore .idea 日志/ * 目标 tmp node_modules 客户端/ node_modules 规范/内部/公共资产 公共/资产

试着加上后缀——force

npm rebuild node-sass --force

**只需执行:** 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