Node Sass could not find a binding for your curren

2019-01-12 13:28发布

I am having issues building an app because node-sass keeps failing with the error.

ERROR in Missing binding /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

I have tried running

npm rebuild node-sass

which says

Binary is fine; exiting.

When running node -v I get v6.2.2

Which is different to what the sass error says "Node 0.10.x". I cant 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. Any ideas?

标签: node.js npm
30条回答
SAY GOODBYE
2楼-- · 2019-01-12 14:06

Please also remember to rename the xxx.node file ( in my case win32-x64-51) to binding.node and paste in the xxx folder ( in my case win32-x64-51),

查看更多
再贱就再见
3楼-- · 2019-01-12 14:06

When building a docker image and attempting to run it locally I ran into this same issue. You need to add a .dockerignore file with the following: .DS_Store .git .gitignore .idea log/* target tmp node_modules client/node_modules spec/internal/public/assets public/assets

查看更多
ゆ 、 Hurt°
4楼-- · 2019-01-12 14:08

This usually happens because the environment has changed since running npm install. Running npm rebuild node-sass builds the binding for the current environment.

查看更多
Viruses.
5楼-- · 2019-01-12 14:08

Answer by @core114 suggesting Uninstalling & installing sass package again works fine for manual process but for automated deployment/CI/CD you need more generic approach. What worked for me is for Continuos deployment of different environment is :

  1. removing old node_modules using rimraf before deployment

    rimraf node_modules

  2. Updating sass package in npm package.json & committing to source control.

For next deployment it will automatically refresh sass for all environment.

查看更多
Lonely孤独者°
6楼-- · 2019-01-12 14:09

Worked for me:

Just delete the node-sass folder and run npm install.  

查看更多
【Aperson】
7楼-- · 2019-01-12 14:09

The problem for me was that the Task Runner Explorer was targeting the solution of my project. When I changed to the project itself using the drop-down list, next to the Task Runner Explorer refresh button, it showed the relevant tasks.

查看更多
登录 后发表回答