Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node Sass couldn't find a binding for your current environment

Tags:

node.js

npm

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 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. Any ideas?

like image 431
wazzaday Avatar asked Jun 23 '16 08:06

wazzaday


People also ask

What is a binding node?

Node. js bindings are series of methods that can be used in Node. js code which are in reality just running C++ code behind the scenes.

What is node sass?

Node sass is a library that allows binding for Node. js to LibSass, the C version of Sass's stylesheet preprocessor. It compiles . scss files to CSS with speed and automatically through connected middleware. SASS (Syntactically Awesome Style Sheets) is a comprehensive version of CSS.

How do I check sass version?

To check the version, run the command: sass –version. The latest version is 1.49.

What does npm rebuild do?

This command runs the npm build command on the matched folders. This is useful when you install a new version of node, and must recompile all your C++ addons with the new binary. It is also useful when installing with --ignore-scripts and --no-bin-links , to explicitly choose which packages to build and/or link bins.


2 Answers

I had the same problem

There is an error in your gulpfile:
Error: Missing binding 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

Found bindings for the following environment:
    - OS X 64-bit with Node.js 4.x

How to solve my problem

By going into project folder and then execute:

npm rebuild node-sass 
like image 181
Bipon Biswas Avatar answered Sep 19 '22 10:09

Bipon Biswas


For those that are using Visual Studio:

Currently working for VS 2015, 2017, 2019, 2022[preview 4] (via below and/or replies from this post)

Task Runner Explorer can't load tasks

For VS 2015

  • Go to: Tools > Options > Projects and Solutions > External Web Tools

For VS 2017(.3) and VS 2019

  • Tools > Options > Projects and Solutions > Web Package Management > External Web Tools (per @nothrow)

In VS 2017 & 2019, you also need to put $(PATH) above $(VSINSTALLERDIR)\Web\External


  • Reorder so that $(PATH) is above $(DevEnvDir)\Extensions\Microsoft\Web Tools\External

enter image description here


Deleting node_modules and running npm install and then npm rebuild node-sass did nothing.

like image 27
Rob Scott Avatar answered Sep 20 '22 10:09

Rob Scott