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?
For me it was the maven-war-plugin that applied filters to the files and corrupted the woff files.
Remove <filtering>true</filtering>
Or if you need filtering you can do something like this:
Fix
npm rebuild node-sass --force
Or, if you are using node-sass within a container:
docker exec <container-id> npm rebuild node-sass --force
Explanation
This error occurs when node-sass does not have the correct binding for the current operating system.
In my experience, it usually happens when you add
node_modules
directly to the container filesystem in your Dockerfile (or mount them use a Docker volume). This is because your container architecture is often different than your current operating system. For example, I installed node-sass on macOS but my container runs Ubuntu.If you force node-sass to rebuild from within the container, node-sass will download the correct bindings for the container operating system.
See my repro case to learn more.
I had the same problem in a Windows environment, receiving the following error:
None of the
npm
commands listed in the other answers here (npm install
,npm rebuild node-sass
, etc.) worked.Instead, I had to download the missing binding and place it in the appropriate destination folder.
The bindings can be found on 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 thedarwin-x64-11_binding.node
file).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 tobinding.node
.Node-sass release URL: https://github.com/sass/node-sass/releases
I'm a Windows 8 user, recently updated Node to
v8.11.1
and npm tov6.0.0
and faced similar issue. Nothing worked -npm install -g node-sass@latest
or deleting thenode-sass
directory from the projectnode_modules/
- none of 'em worked for me.The Laravel Mix was throwing an error to my browser console saying a missing node:
win32-x64-57
. I don't know whether it's because a slower internet connection or something, the node was missing during the update.Hence some of the answers directed me to look at the Node-Sass releases, and I found the solution.
npm view node-sass version
(the{your version}
in step 4)C:\Users\{User}\AppData\Roaming\npm-cache\node-sass\{your version}\
and put the downloaded.node
file inside the version folderAnd you are done.
In my case the node-sass version was
4.9.0
and the missing node waswin32-x64-57_binding.node
, so I downloaded the.node
file from 4.9.0 release and followed step 4.For my particular case none of the above answers worked. So what it worked:
npm cache verify
to check that nothing is left in the cacheAltough I haven't tried to reproduce the sequence it was a combination of the above that worked. In addition you may also try:
npm install --save node-sass
ornpm install node-sass -g
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. 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.
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.