本文翻译自:Node Sass couldn't find a binding for your current environment
I am having issues building an app because node-sass keeps failing with the error. 我在构建应用程序时遇到问题,因为node-sass不断因错误而失败。
ERROR in Missing binding /Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node 缺少绑定/Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node中的错误
Node Sass could not find a binding for your current environment: OS X 64-bit with Node 0.10.x Node Sass找不到您当前环境的绑定:带有Node 0.10.x的OS X 64位
I have tried running 我试过跑步
npm rebuild node-sass
which says 这说
Binary is fine; 二进制很好; exiting. 退出。
When running node -v I get v6.2.2 当运行node -v我得到v6.2.2
Which is different to what the sass error says "Node 0.10.x". 这与sass错误显示“节点0.10.x”不同。 I can't figure out why it is getting the wrong version. 我不知道为什么它得到了错误的版本。 I have also tried removing the node_modules folder and running npm update or npm install, both of which did not resolve the issue. 我还尝试了删除node_modules文件夹并运行npm update或npm install,但这两种方法都无法解决问题。 Any ideas? 有任何想法吗?
#1楼
参考:https://stackoom.com/question/2ZO6K/Node-Sass找不到您当前环境的绑定
#2楼
I had a similar problem and the reason was that there were two versions of Node installed in my machine: one "global" and another one at the project level. 我有一个类似的问题,原因是我的计算机上安装了两个版本的Node:一个是“全局”版本,另一个是在项目级别。 Sass will build correctly only if the Gulp build is running under Node.js 4.x version, so make sure you upgrade the version of Node you are using. 仅当Gulp构建在Node.js 4.x版本下运行时,Sass才能正确构建,因此请确保升级所使用的Node版本。
PS: If you completely remove the node_modules folder in your project and re-build from scratch, npm will download the correct dependencies for your current system & node version. PS:如果您完全删除了项目中的node_modules文件夹并从头开始重建,npm将为您当前的系统和节点版本下载正确的依赖项。
#3楼
I had the same problem 我有同样的问题
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
That was because I did npm install using a different nodejs version, try deleting node_modules folder installing and starting 那是因为我使用不同的nodejs版本进行了npm安装,请尝试删除node_modules文件夹进行安装和启动
cd your_proyect
rm -rf node_modules
npm install
npm start or gulp or whatever
If you are using nvm do 如果您使用的是nvm
nvm use stable // or your favorite version
// remove node_module directory
npm install
npm start or gulp or whatever
#4楼
I had the same problem 我有同样的问题
There is an error in your gulpfile: 您的gulpfile中存在错误:
Error: Missing binding E:\\allapp\\badshaindiancuisine\\node_module\\node-sass\\vendor\\win32-x64-46\\binding.node 错误:缺少绑定E:\\ allapp \\ badshaindiancuisine \\ node_module \\ node-sass \\ vendor \\ win32-x64-46 \\ binding.node
Node Sass could not find a binding for your current environment:Windows 64-bit with Node.js 4.x Node Sass找不到您当前环境的绑定:Windows 64位,带有Node.js 4.xFound bindings for the following environment: 找到以下环境的绑定:
- OS X 64-bit with Node.js 4.x -带有Node.js 4.x的OS X 64位
How to solve my problem 如何解决我的问题
By going into project folder and then execute: 通过进入项目文件夹,然后执行:
npm rebuild node-sass
#5楼
I had the same problem in a Windows environment, receiving the following error: 我在Windows环境中遇到相同的问题,收到以下错误:
Error: Missing binding C:\\Development{ProjectName}\\node_modules\\node-sass\\vendor\\win32-ia32-47\\binding.node 错误:缺少绑定C:\\ Development {ProjectName} \\ node_modules \\ node-sass \\ vendor \\ win32-ia32-47 \\ binding.node
Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 5.x Node Sass找不到您当前环境的绑定:Windows 32位,带有Node.js 5.x
Found bindings for the following environments: 找到以下环境的绑定:
- Windows 64-bit with Node.js 6.x -具有Node.js 6.x的Windows 64位
None of the npm commands listed in the other answers here ( npm install , npm rebuild node-sass , etc.) worked. 此处其他答案( npm install , npm rebuild node-sass等)中列出的npm命令均npm install 。
Instead, I had to download the missing binding and place it in the appropriate destination folder. 相反,我必须下载缺少的绑定并将其放在适当的目标文件夹中。
The bindings can be found on git . 绑定可以在git上找到。 Match the file with the folder name identified after /node_modules/node-sass/vendor/ in your error message ('darwin-x64-11' in your case, so you'd want the darwin-x64-11_binding.node file). 将文件与错误消息中/node_modules/node-sass/vendor/之后标识的文件夹名进行匹配(对于您的情况为'darwin-x64-11',因此,您需要darwin-x64-11_binding.node文件)。
Create the missing folder in your project ( /node_modules/node-sass/vendor/darwin-x64-11 ), copy the .node file to the new directory, and rename it to binding.node . 在项目中创建缺少的文件夹( /node_modules/node-sass/vendor/darwin-x64-11 ),将.node文件复制到新目录,然后将其重命名为binding.node 。
Node-sass release URL: https://github.com/sass/node-sass/releases Node-sass发行URL: https : //github.com/sass/node-sass/releases
#6楼
Note I'm using VS 2015, 64-bit Windows 7. 注意我正在使用VS 2015、64位Windows 7。
Also works for VS 2017 (from replies to this post) 也适用于VS 2017(来自此帖子的回复)
Task Runner Explorer can't load tasks Task Runner Explorer无法加载任务
For VS 2015 对于VS 2015
- Go to: Tools > Options > Projects and Solutions > External Web Tools 转到:工具>选项>项目和解决方案>外部Web工具
For VS 2017(.3) 对于VS 2017(.3)
- Tools > Options > Projects and Solutions > Web Package Management > External Web Tools (per @nothrow) 工具>选项>项目和解决方案> Web软件包管理>外部Web工具(每个@nothrow)
In VS 2017, you also need to put $(PATH) above $(VSINSTALLERDIR)\\Web\\External 在VS 2017中,还需要将$(PATH)放在$(VSINSTALLERDIR)\\ Web \\ External之上
- Reorder so that $(PATH) is above $(DevEnvDir)\\Extensions\\Microsoft\\Web Tools\\External 重新排序,以使$(PATH)在$(DevEnvDir)\\ Extensions \\ Microsoft \\ Web Tools \\ External之上
Deleting node_modules and running npm install and then npm rebuild node-sass did nothing . 删除node_modules并运行npm install ,然后npm rebuild node-sass 并没有执行任何操作 。
在构建应用时遇到Node Sass错误,提示缺少当前环境(如OS X 64-bit with Node 0.10.x)的绑定。尝试删除node_modules文件夹并重新运行npm install,或者检查系统中是否存在多个Node.js版本。如果使用nvm,切换到正确版本的Node.js。在某些情况下,可能需要手动下载缺失的绑定文件并放置到相应目录。

2420

被折叠的 条评论
为什么被折叠?



