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


当前回答

这是可能不会发生在其他人身上的事情,但在我的情况下,当我决定重新启动我的项目(遵循不同的vue.js教程)时出现了这个错误。

造成我问题的步骤是:

# move my existing project
mv project-name project-name-old
# create a new project
vue create project-name
# run server
npm run server

问题是我之前的服务器仍然在不同的终端选项卡上运行。在localhost:8080上,仍然显示的页面是旧的项目。

我所要做的就是关闭终端中的旧服务器,并再次执行“npm run serve”(或查看localhost:8081)。

以防这让别人困惑了半个小时,或者是为了搞笑。

其他回答

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-sass的post依赖项将无法安装。node-sass中的Json

手动运行它为我解决了问题

node node_modules/node-sass/scripts/install.js 

信贷:链接

我也有同样的问题

    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

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

NPM重建node-sass——force

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

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

npm start

没有一个安装/重建解决方案为我解决了这个问题(使用gulp)。

我是这样解决的:

1)从存储库下载丢失的绑定文件。

2)将文件重命名为binding.node。

3)如果不存在node_modules/node-sass/vendor/darwin-x64-11(错误信息中的路径)目录。

4)将绑定文件添加到“node_modules/node-sass/vendor/darwin-x64-11”目录下