713

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?

Simson
  • 3,373
  • 2
  • 24
  • 38
wazzaday
  • 9,474
  • 6
  • 39
  • 66
  • 18
    Are you using a node version manager such as `nvm`? If you are sometimes it messes up some of the npm module paths and they try using a version, different that the current one. If not you could always try removing the `node_modules` folder and installing the dependencies again – Vasil Dininski Jun 23 '16 at 09:06
  • 3
    Hey im not using nvm and I tried the removal/re-install step. no luck. – wazzaday Jun 23 '16 at 09:17
  • what is your development environment? you use VS.NET 2105? – Mike Anderson Dec 09 '16 at 13:38
  • @VasilDininski I'm using nvm, what should I do? – Subkhan Sarif Apr 25 '17 at 06:12
  • What error message did you receive? And what is your dev environment? – Vasil Dininski Apr 25 '17 at 07:47
  • Have you tried removing your `~/.node-gyp` or `~/.npm` folder? Mentioned below. – prasanthv Nov 14 '17 at 20:09
  • I've tried deleting the `node_modules` directory and also running `npm install`, followed by `npm rebuild node-sass --force`, but to of no avail. I installed node via npm. But, for some reason, my build environment thinks I need a Linux build even though I'm running on Mac OS X: ```Module build failed: Error: Missing binding /frontend/node_modules/node-sass/vendor/linux-x64-57/binding.node Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x Found bindings for the following environments: - OS X 64-bit with Node.js 8.x``` – ayl Jul 03 '18 at 04:16
  • 8
    Open Visual Studio 2017 Go to Tools -> Options…Go to Projects and Solutions -> Web Package Management move $(PATH) to the top of that list and close that window. In my case this solution worked because my node version is 11.x – Zahari Kitanov May 04 '19 at 10:55
  • Very much late . As I got this issue today only after I update my system nodejs version in windows 10. I removed both node_modules folder and the package_lock.json from work directory and run npm install and it starts working. – user1162084 Feb 24 '21 at 06:42
  • npm rebuild node-sass Works for me on MacOS – Guillaume Lauzier Jun 07 '21 at 11:23

63 Answers63

962

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 the problem

By going into the project folder and then executing the command:

npm rebuild node-sass
Kingsley Mitchell
  • 2,412
  • 2
  • 18
  • 25
Bipon Biswas
  • 11,397
  • 1
  • 26
  • 37
363

For those that are using Visual Studio:

Currently working for VS 2015, 2017, 2019, 2022 (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), VS 2019, and VS 2022

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

In VS 2017, 2019, 2022, 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.

Rob Scott
  • 7,921
  • 5
  • 38
  • 63
  • 5
    If you are using VS2015 you should definitely make the changes described in this answer. It's probably all you will need to do to fix this issue. – Bonneville Jan 17 '17 at 02:30
  • 12
    This also worked for a brand new install of VS2017 also. – sarin Mar 10 '17 at 14:19
  • 2
    This fixed by issue. @wazzaday I believe this should be the accepted answer for others to find the answer easily. – To Ka May 11 '17 at 19:24
  • 8
    In VS2017.3, the path to the setting is `Tools > Options > Projects and Solutions > Web Package Management > External Web Tools` – nothrow Sep 06 '17 at 20:17
  • This worked out for me also. I'm running VS Professional 2015 – Sukhjeevan Jan 15 '18 at 21:24
  • This fixed my issue (and the rest of my dev team has come across this - I've had some rollback to 5.0 node just to get this working). – James Haug Feb 15 '18 at 17:52
  • Fantastic answer, I've been having issues with VS2017 and where is grabs external pieces. – JoeCo Aug 07 '18 at 20:56
  • 11
    damn!i would never figure it out... all to compile stupid sass with stupid node in stupid javascript – L.Trabacchin Aug 12 '18 at 07:41
  • This worked for me after deleting node_modules from the project. (Running VS2017) – ZhaoYiLi Aug 16 '18 at 19:52
  • If creating a docker image, and receiving this error during the docker build, you must ensure you didn't accidentally include a node_modules directory from your host drive. You need to have a .dockerignore file containing an exclusion for 'node_modules', otherwise those files from your hist will be copied into the container during a 'copy . .' command. The when building a node project in the container which is most likely based off a different underlying Os image, it will attempt using the binding node which was copied in from the host OS - which is obviously the wrong one. – nemaroller Jan 26 '19 at 20:10
  • 20
    Can confirm, this is still a thing in VS 2019. – JamesT Jul 24 '19 at 08:26
  • 1
    Thank you for reminding me to move environment variables above VS extensions – DoomVroom Mar 09 '20 at 17:34
  • Deleting node_modules really helped. – Manish Gupta Apr 08 '20 at 09:24
  • 2
    Not sure why using node in VS is so difficult, with this many gotchas. Spent hours on this issue; tried everything until I moved the path above the external tools. The errors in Task Runner Explorer gave no indication of the underlying problem. – Alex Feb 15 '21 at 12:12
  • 2
    Still a thing in VS2022 as well (Preview 4, at least) – Kevin Welsh Sep 24 '21 at 21:21
192

**Just execute: ** npm rebuild node-sass --force



If the above for some reason didn't work out for you, try this:
  1. Delete node-sass folder under node_modules
  2. npm install

In my case it also couldn't find Python.

Following procedure solved the issue (Windows):

npm rebuild node-sass --force
-- cannot find python.exe, if you have Python installed, add it to your path:
set PYTHON=C:\Python27\Python.exe
-- else: download python "Windows x86-64-MSI" installer from https://www.python.org/downloads/release/python-2714/
-- install python
-- at installation start check: add env variable to path
-- after successfull installation:
npm rebuild node-sass --force
-- finished successfully
Legends
  • 21,202
  • 16
  • 97
  • 123
  • 2
    The above worked for me, albeit that it occurred twice in two different apps in two different folders. The python install was a one-off (i.e.not needed when I got the error a second time on my other app) and I didn't need the final npm run build command (not explicitly at least) but I did need to run the rebuild --force twice for both my apps. – Greg Trevellick Jul 20 '18 at 19:32
  • 1
    Rebuild need more then 10 minutes on my Ubuntu 20.04. – Goran_Ilic_Ilke Jul 16 '21 at 13:31
169

Worked for me:

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

maxshuty
  • 9,708
  • 13
  • 64
  • 77
Codiee
  • 3,047
  • 2
  • 17
  • 18
  • 5
    This works for me too. Clearly a node version conflict. Thanks! – Liz Lemon Feb 23 '18 at 07:25
  • 1
    Did have to delete it the following directory: C:\Users\your_user_name\AppData\Roaming\npm-cache – Matt Sep 06 '18 at 20:07
  • 8
    This worked! `npm rebuild node-sass` did not work for me. (Mac with WebStorm) – Jackpile Oct 11 '18 at 23:17
  • 3
    This is the only solution that worked for me! ```npm rebuild node-sass --force``` didn't work either. – bigsee Apr 24 '19 at 16:16
  • This should be marked as the answer. Until now I had no idea why my solution kept targeting a higher version of node and kept giving me error message about nodesass. I had a step in the Azure pipeline to force the node version to the one I want. Now I can removed that step! – James Blackburn Feb 19 '20 at 11:22
  • npm uninstall node-sass followed by npm install node-sass and finally adding the python.exe file with directory to the env Path variable – Soumya C Mar 03 '22 at 15:08
153

I had the same problem in a Windows environment, receiving the following error:

Error: Missing binding 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
Found bindings for the following environments:
   - Windows 64-bit with Node.js 6.x

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 the darwin-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 to binding.node.

Node-sass release URL: https://github.com/sass/node-sass/releases

Maurizio L
  • 43
  • 1
  • 6
Beofett
  • 2,388
  • 1
  • 23
  • 37
  • 3
    Also worked for me, thanks! Tried cleaning up node_modules, deleting cache, rifraf, rebuild node-sass, rebuild from VS2015 instead of from command line with npm and at the end this fixed it. – Artur Carvalho Jan 11 '17 at 19:02
  • I had to place to file in C:\Users\USERNAME\AppData\Roaming\npm\node_modules\node-sass\vendor\win32-x64-57\ – aLx13 Jan 02 '18 at 12:52
  • And each time you set up your project you must redo?seems a bit cumbersome – Jan Ciołek Feb 20 '18 at 12:59
  • 1
    @JanCiołek I only had this happen once, so I never had to redo this. I'm not sure if it was version specific, or if there was just a problem with the specific install, but I found no better solution (the other answers here did not work for me). Cumbersome or not, it seemed to be the necessary solution for some variations of this problem. – Beofett Feb 20 '18 at 13:07
  • 1
    @Beofett This bug ate alot of my time,i did all that was mentioned in this thread but i forget to run compilation.Thanks ! – Jan Ciołek Feb 20 '18 at 13:11
  • 6
    This is the only answer that worker for me, but found my binding in https://github.com/sass/node-sass/releases instead of the linked URL. Cheers – clapas Mar 15 '18 at 10:18
  • My error says 'linux-x64-57/binding.node' which is not available on the git url that you posted. update: found it :) – Vipin Verma Mar 17 '18 at 22:19
  • 2
    Thank you @Beofett. Your answer saved me to run my Ionic project in Windows and Mac OSX. – Marcus Crisostomo Apr 09 '18 at 14:35
  • I tried using that and now it tells me that it could not find the bindings even though one line later it stated that it found them... – Chrisstar Jan 21 '19 at 19:39
  • 1
    This is the only thing that worked for me - On Linux 64 with Node 12.6. For some reason, node-sass wanted the binding for Node 8.x. I had to manually create the linux-x64-57 folder, download the binary binding.node, and copy it into that folder. – AJ. Aug 28 '19 at 18:10
  • thanks! this seems a bit "hacky", but as long as it works I'm a happy camper :) – henrik Oct 21 '19 at 09:42
  • This also work for me but when you reinstall the node_modules folder you will have the same issue right? – Wartodust Feb 23 '21 at 09:43
39

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.

Rocío García Luque
  • 3,597
  • 31
  • 31
39

npm rebuild node-sass --force

Or, if you are using node-sass within a container:

docker exec <container-id> npm rebuild node-sass --force

This error occurs when node-sass does not have the correct binding for the current operating system.

If you use Docker, this error usually happens when you add node_modules directly to the container filesystem in your Dockerfile (or mount them using a Docker volume).

The container architecture is probably 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.

Sherwood Callaway
  • 1,428
  • 1
  • 14
  • 18
  • 1
    Facing the same issue with different environments: - dev under MacOS for unit tests - dev using docker-compose (for full system interactions) - prod under alpine-based OS ; Mounting (or not) and `npm install` (or not) in docker is problematic when having architecture dependent modules: getting *darwin* or *linux* binaries depending on where you `npm i` It happens for NodeJS modules like `node-sass`, or `@google-cloud/pubsub` – Laurent Dec 02 '18 at 19:37
  • Thank you for mentioning the solution for docker, this is exactly what fixed it for me! – Joshua Soileau Apr 24 '19 at 12:27
  • I had `/node_modules` which was being bind mounted into the container at `/app/node_modules`. Even though my `NODE_PATH` was `/node_modules` (which did exist) and should have been in a different spot.., it randomly started causing issues. I had installed at both places so that my dev deps for prettier would work with my vscode. whoops. weird stuff. Thank you for the docker mention <3 – Nick Brady Apr 19 '20 at 23:18
  • I found this worked after deleting /node_modules/, then running 'npm install' then your command 'npm rebuild node-sass --force' – Archie Butler Sep 08 '20 at 10:58
22

node-sass node module uses darwin binary file which is dependent on the version of node. This issue occurs when the binary file is not downloaded or wrong binary file is downloaded.

[![Node sass error][1]][1]

Reinstall node modules will download expected binary of node-sass:-

For Mac users:

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

For Windows users:

rmdir node_modules
npm cache clean --force
npm i
npm rebuild node-sass --force

but for some users, you need to check your node version's compatibility with node-sass version. Make it compatible using below table and run above commands again to fix this issue.

This is node compatibility table with node-sass

NodeJS | Supported node-sass version | Node Module
Node 19     8.0+                        111
Node 18     8.0+                        108
Node 17     7.0+                        102
Node 16     6.0+                        93
Node 15     5.0+                        88
Node 14     4.14+                       83
Node 13     4.13+, <5.0                 79
Node 12     4.12+                       72
Node 11     4.10+, <5.0                 67
Node 10     4.9+, <6.0                  64
Node 8      4.5.3+, <5.0                57
Node <8     <5.0                        <57

If issue is still not fixed, check node-sass supported environment's list:- https://github.com/sass/node-sass/releases/

Balram Singh
  • 1,576
  • 19
  • 30
  • Also, if you clone others project you need to change the node in your package.json to your current node version. – Sari Masri Jun 18 '20 at 10:24
20

in some cases you need to uninstall and install node-sass library. Try:

npm uninstall --save node-sass

and

npm install --save node-sass

look at this its work for me, Stack link here

core114
  • 5,155
  • 16
  • 92
  • 189
19

* Docker related answer here *

Answer for if you are seeing this problem, or something similar, and are using Docker.

Cause: When copying over the current file structure to inside the Docker container, you may be copying over node modules from one OS system to another (e.g. a Mac to Linux container).

Solution:

Add a .dockerignore, and inside add:

node_modules

This will cause an npm install to install the bindings for the docker environment, rather than your local machine environment.

farrellw
  • 1,340
  • 15
  • 12
  • Can someone elaborate this answer? This is something I needed, but it would be helpful if anyone can explain this answer. Thanks – Waseem Dec 07 '22 at 15:04
18

If your terminal/command prompt says:

Node Sass could not find a binding 
for your current environment: 
OS X 64-bit with Node 0.10.x

and you have tried the following commands such as:

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

& still NOTHING works..

Just run this in the terminal manually:

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

now run

npm start or yarn start
Jackie Santana
  • 1,290
  • 14
  • 15
14

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

cd your_project
rm -rf node_modules
npm install
npm start or gulp or whatever

If you are using nvm do

nvm use stable // or your favorite version
// remove node_module directory
npm install
npm start or gulp or whatever
Julien Jacobs
  • 2,561
  • 1
  • 24
  • 34
gsalgadotoledo
  • 2,666
  • 1
  • 25
  • 22
14

Try to add suffix --force

npm rebuild node-sass --force
user3890355
  • 1,010
  • 13
  • 13
14

For my particular case none of the above answers worked. So what it worked:

rm -rf node_modules 
rm -rf /tmp/* 
rm -rf /root/.npm/node-sass 
npm uninstall --save node-sass 
npm cache clean --force 

npm cache verify to check that nothing is left in the cache

npm install

Altough 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 or npm install node-sass -g

npm rebuild node-sass
npm install bindings
Michael W. Czechowski
  • 3,366
  • 2
  • 23
  • 50
Alex P.
  • 1,140
  • 13
  • 27
8

I had the same problem with Node v7.4.0 Current (Latest Features).

Did some reading here and downgraded Node to v6.9.4 LTS and after running npm rebuild node-sass it downloaded the binary and everything started working.

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-48_binding.node
Download complete .] - :
Binary saved to D:\xxx\xxx-xxx\node_modules\node-sass\vendor\win32-x64-48\binding.node
Caching binary to C:\Users\user\AppData\Roaming\npm-cache\node-sass\3.13.1\win32-x64-48_binding.node`

Owen Blacker
  • 4,117
  • 2
  • 33
  • 70
krankuba
  • 1,283
  • 1
  • 17
  • 20
6

I'm a Windows 8 user, recently updated Node to v8.11.1 and npm to v6.0.0 and faced similar issue. Nothing worked - npm install -g node-sass@latest or deleting the node-sass directory from the project node_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.

  1. Step 1: Check your node-sass version using the command: npm view node-sass version (the {your version} in step 4)
  2. Step 2: Get to Node-Sass Releases
  3. Step 3: Get your release and find the missing node in the assets listed under every release, and download the file
  4. Step 4: Get to your PC's C:\Users\{User}\AppData\Roaming\npm-cache\node-sass\{your version}\ and put the downloaded .node file inside the version folder

And you are done.

In my case the node-sass version was 4.9.0 and the missing node was win32-x64-57_binding.node, so I downloaded the .node file from 4.9.0 release and followed step 4.

Mayeenul Islam
  • 4,532
  • 5
  • 49
  • 102
  • 2
    Woaw... we got stuck on this for a full hour on a colleague's computer before finding this anwser. Nothing else worked, even trashing the whole node_modules directory. This completely solved the issue for us, thanks a lot for your help. – ZeRemz Jul 16 '20 at 13:18
5

For Visual Studio 2015/2017, Right Click on your package.json and Click on Restore Packages.

This will make sure that the npm from the Visual Studio Tools External Tools is run and the binding will be rebuild based on that.

4

I had the same issue. I couldn't find any proper working solution in here, so I found mine:

Inspired by @Rob-Scott solution and other pointing that we could have 2 versions of Node.js installed, I went to C:\Program Files (x86)\nodejs and realized that I had a node.js version installed in addition to the VS default installation.

My solution was quite simple:

  • Go to Tools > Options > Projects & solutions > Web package management > External web tools
  • Click on add an entry (most left of the top-right block of buttons)
  • Enter C:\Program Files (x86)\nodejs, validate by pressing enter
  • Bring it at the top of the list
  • Enjoy

Probably Node.js is not set well in the PATH variable, but this is my working very quick solution, my 2 cents :)

Jean
  • 4,911
  • 3
  • 29
  • 50
4

This happens when in your workstation you run an update of Node.js and you are using node-sass globally.

So you should uninstall node-sass globally

npm uninstall -g node-sass

And then you have to install it globally, again

npm install -g node-sass
Nico
  • 156
  • 4
4

The post dependencies for node-sass is not getting installed without the package.json inside node-sass

Running it manually solved for me

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

credit: link

Mukundhan
  • 3,284
  • 23
  • 36
4

Run the following commands, it works fine for me.

npm install node-sass -g

npm rebuild node-sass

nvm use 10.16.3

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

ng serve --poll=2000

Aditya Prakash
  • 1,549
  • 2
  • 15
  • 31
pavithra
  • 105
  • 1
  • 8
4

This worked for me: yarn add --force node-sass@4.14.1 or yarn add --force node-sass

lava-lava
  • 989
  • 9
  • 20
3

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

Saugat Bhattarai
  • 2,614
  • 4
  • 24
  • 33
Kisz Na
  • 372
  • 4
  • 11
3
  1. Create a new directory in node_modules/node-sass/vendor/linux-x64-46/ .
  2. the download fil from https://github.com/sass/node-sass/releases
    (linux-x64-59_binding.node) based upon your version.
  3. paste it in node_modules/node-sass/vendor/linux-x64-46/ rename it to binding.node
  • although not a good practice, this solution might actually work (when all others fail) so when downvoting, it should be clarified why – Alex P. Nov 23 '18 at 12:00
3

I had this issue when upgrading from VS 2017 Professional to Enterprise

  1. Close VS
  2. Delete node_modules
  3. Open VS
  4. Right click package.json and select 'restore packages'
dk_french032
  • 638
  • 1
  • 7
  • 22
  • This is the safest approach for Visual Studio. Forget about all of these commands because they probably won't work. The commands have to be run from the *same* environment, which is the tricky part. Let visual studio do it and you're set. – AlexPi Jul 06 '20 at 19:51
3
  1. Delete node_modules folder.
  2. Install dependencies again. (npm i)
Shivam Kubde
  • 545
  • 1
  • 8
  • 17
3

None of the install/rebuild solutions resolved the issue for me (using gulp).

Here is how I resolved it:

1) Download the missing binding file from the repository.

2) Rename the file binding.node.

3) Create node_modules/node-sass/vendor/darwin-x64-11 (path from error message) directory if it doesn't exist.

4) Add the binding file to node_modules/node-sass/vendor/darwin-x64-11

Don
  • 3,876
  • 10
  • 47
  • 76
3

Just refresh your npm cache and:

npm cache clean --force  
npm install

It always works for me in the same case.

UPD: Your problem may also be by reason of absence of a global sasslib.

npm install -g sass
AlexK
  • 39
  • 3
3

Open Visual Studio 2017
Go to Tools -> Options…
Go to Projects and Solutions -> Web Package Management
Move $(PATH) to the top of that list and close that window.
Restart Visual Studio.
This worked in my case, because my node version is 11.x

Zahari Kitanov
  • 510
  • 7
  • 15
  • 1
    Definitely a valid answer when different projects use different bindings. Executing `rebuild node-sass` was not enough. Changing the path priority fixed this. – Tim Vermaelen Oct 25 '19 at 13:58
3

Probably you have a build with different node version than the current one. Try running these commands and it should fix the issue.

npm cache clean --force &&  
rm -rf node_modules &&  
rm -rf package-lock.json &&  
npm i
Abdelsalam Megahed
  • 1,281
  • 12
  • 13
2

A similar error I encountered with Visual Studio 2015 Community Edition while having created an AspNetCore app was:

Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 5.x
Found bindings for the following environments:
  - Windows 64-bit with Node.js 6.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to build the binding for your current environment.
    at module.exports ([..]\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> ([..]\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> ([..]\node_modules\gulp-sass\index.js:187:21)
    at Module._compile (module.js:397:26)

You can see the from the error above that the cause was from a version mismatch on the bindings for nodejs.

Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 5.x

Found bindings for the following environments: - Windows 64-bit with Node.js 6.x

The solution I found was to

  • Install the nodejs windows version,
  • Add path for node js (C:\Program Files\nodejs) in External Web Tools (see Rob Scott's answer),
  • Move nodejs path above $(PATH).
Matt R
  • 2,577
  • 5
  • 30
  • 46
2

This worked for me Deleting node_modules and then restoring packages from IDE and then npm rebuild node-sass

Nouman Bhatti
  • 1,341
  • 6
  • 28
  • 54
2

node-sass runs an install script to download the required binary. If there are no environment variables, .npmrc variables or process arguments set then the binary is determined by using the current process platform, architecture and Node ABI version. Therefore, if you run node install in one application and then try to run node-sass in an application with a different platform/architecture/ABI, the binary won't have been downloaded. The solution is to manually download the binary or to fix the binary version using an environment variable (SASS_BINARY_NAME) or a .npmrc variable (sass_binary_name)

You can see the logic for this in the getBinaryPath function in node-sass\lib\extensions.js

Tevin
  • 1,394
  • 16
  • 26
2

I had to first choose the new default node version nvm use *** or nvm install *** and then remove all in node_modules in the project and npm i again.

obotezat
  • 1,041
  • 16
  • 20
2

Just run the comment thats it.

npm rebuild node-sass

enjoy your coding...

Community
  • 1
  • 1
Mahendren Mahisha
  • 1,072
  • 11
  • 9
2

Just before removing your node_modules or clean your cache, which cost you time, try running

npm rebuild node-sass --force

in your project folder. Like mine, chance is high that your problem gets solved. In case it was not successful try the followings:

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

npm start
Ali Safari
  • 1,535
  • 10
  • 19
1

I just run npm rebuild instead of npm rebuild node-sass and issue gone.. I don't know what is the magic behind though.

Alien13
  • 11
  • 1
1

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),

Devdutta Natu
  • 171
  • 1
  • 7
1

I tried all the above, nothing worked, I was trying to match the node version to the node-sass version when I decided to go to the official node.js website, download the latest node version(currently v14 and I was on v12) and install it. This fixed my issue at last! It's possible that your node-sass version is ahead of your node.js version.

Archie Butler
  • 455
  • 6
  • 20
1

I did all these in Linux Mint:

  • Remove node_modules
  • Ran npm install
  • Ran npm rebuild node-sass

But it didn't fix the issue and still getting the error about node-sass.

I tried running again the command for rebuilding node-sass with sudo i.e. sudo npm rebuild node-sass and it worked finally!

phagento
  • 410
  • 4
  • 13
1

I was getting this error when trying to use node-sass in docker on MacOS and none of the solutions here worked.

The error happened because I did an npm install before trying to build the docker image. The npm install was correctly pulling the MacOS version of node-sass into my node_modules and I was then copying the node_modules to my docker image running Linux. This fails because it can't run the MacOS version of node-sass on Linux.

In my case the solution was adding this to my makefile after the npm install step:

docker-compose run --rm --entrypoint "bash -c" mydockerimage "npm rebuild node-sass"
Vlad Schnakovszki
  • 8,434
  • 6
  • 80
  • 114
  • Hmmn I was having the error on My MacOs ```Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 16.x``` I ended up removing node_modules locally and ran the docker-comppose command. The docker was built successfully. – qwas Jun 01 '23 at 00:40
0

Check your system: Does your system has 2 different Node.js installation?

If you install node from nodejs, the default installation directory is C:\Program Files\nodejs I had the node version 6.xx installed here.

Check your VS External web tools directory C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External I had the node version 5.xx installed there.

One work around is :

  • Make backup of C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External directory.
  • Copy C:\Program Files\nodejs directory content and
  • paste into C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External Directory.
  • Delete node_modules directory from your solution.
  • Re run the project. If you get error message re run the project second time.

If that does not work

  • Delete node_modules directory from your solution.

NOTE: $ is the command prompt

$  npm install 
…
$ npm run build:dev

Rerun the project.

Jean
  • 4,911
  • 3
  • 29
  • 50
0

For people that switched to nvm from system node, if you haven't removed the ~/.npm and ~/.node-gyp folder this problem can arise since perhaps the node version within ~/.node-gyp could be different.

In any case those folders should be removed.

prasanthv
  • 2,442
  • 2
  • 21
  • 17
0

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.

Pranav Singh
  • 17,079
  • 30
  • 77
  • 104
0

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.

Lewis Hamill
  • 171
  • 1
  • 13
0

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

  • 1
    Many people will probably not get this far down in the answers, but if anyone is getting this error in building a docker image and installing node, people are probably including node_modules from their host file system by mistake (a copy . . comand). A .dockerignore file with nodes_modules within it at the root project level will resolve this. – nemaroller Jan 26 '19 at 20:06
0

For me it was the maven-war-plugin that applied filters to the files and corrupted the woff files.

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
    <webResources>
        <resource>
            <directory>dist</directory>
            <filtering>true</filtering>
        </resource>
    </webResources>
</configuration>

Remove <filtering>true</filtering>

Or if you need filtering you can do something like this:

<plugin>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <webResources>
            <resource>
                <directory>dist</directory>
                <excludes>
                    <exclude>assets/**/*</exclude>
                </excludes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>dist</directory>
                <includes>
                    <include>assets/**/*</include>
                </includes>
            </resource>
        </webResources>
    </configuration>
</plugin>
Viktor Eriksson
  • 5,677
  • 3
  • 20
  • 24
0

I have tried all methods I've found.

I have noticed some strange behavior of that folder. When I was trying to "cd" to 'node_sass' folder from VS terminal, it told that "Folder was not found", but was seen in Finder.

chmod from VS terminal haven't find folder even with 'sudo' command.

I have chmod-ed from native MacOs terminal and just after have rebuild with node.

diginix
  • 21
  • 1
0

I fixed this by changing JAVA_HOME from x86 to x64. Maven was running on x86 but node was using x64. Remove /node and /node_modules and build again.

0

Please write below command on Root Folder.

npm rebuild node-sass

100% works...

Yogesh Kumar
  • 1,016
  • 11
  • 10
0

This is something that may not happen to anyone else, but in my case, this error appeared when I decided to restart my project (to follow a different vue.js tutorial).

The steps that created my problem was:

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

The problem was that my previous server was still running on a different terminal tab. On localhost:8080, the page that was still showing was the old project.

All I had to do was shut down the old server in the terminal and execute "npm run serve" again (or view localhost:8081).

Just in case this confounds someone else for half an hour, or for laughs and giggles.

althras
  • 48
  • 6
0

remove the /node-modules folder and install it again or run the gradle task deploy after it removed

/Users/warren/Sites/random-docs/my-cms/node_modules/node-sass/vendor/darwin-x64-11/binding.node

It solves your problem.

suatCoskun
  • 812
  • 2
  • 10
  • 14
0

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.

Tripp Cannella
  • 1,094
  • 1
  • 8
  • 9
0

On linux ubuntu 20.04 I needed few steps,downgrade node first to apropriate version,remove node_modules,run yarn install and finally run sudo yarn add node-sass@4.13.0 --force.Node version 10.0.0. Only working way for me.

Goran_Ilic_Ilke
  • 812
  • 12
  • 16
0

Check if your version of npm is the same that you project require to

Rafał
  • 572
  • 4
  • 21
0

In my case, I found that the node-sass version in package-lock.json was different from the node-sass version in package.json. This steps solves my problem.

  1. delete folder node-modules
  2. delete package-lock.json
  3. install python 2.7
  4. add C:/Python27;C:/Python27/Scripts to Environment Variable -> Path
  5. in Powershell, run as administrator -> npm install -g node-gyp
  6. in my working folder -> npm install

Hope this works for you too

farizmamad
  • 171
  • 2
  • 6
0

I, just for adding i was on Windows and i resolved my issue by removing the node-sass entry in my user's node_module folder (C:/users/$username/node_modules/node_sass )

Rebuilding and removing node_sass did nothing before and now my issue is resolved !

Ciriak
  • 169
  • 1
  • 5
0

Further to Abdelsalam Megahed's brief answer, which contained most of the solution... (i.e. view his answer and do that first)

After following the four short steps Abdelsalam suggested, I ran npm run dev and received the following message:

Failed to load C:\path\tsconfig.json: Missing baseUrl in compilerOptions

The final step was to edit the tsconfig.json file and add "baseURL": ".",, under "compilerOptions":, like this:

"compilerOptions": {
    "baseUrl": ".",
    etc etc etc

The problem was resolved at this point.

Note: It may be necessary to hard-reset CtrlF5 the page to see the change (even with nodemon).

cssyphus
  • 37,875
  • 18
  • 96
  • 111
0

If you got to the end of this thread, and things are still not working. It may be silly, but try verifying if you have any of these files in your folder:

  • .node-version
  • .nvmrc

They are the culprit of why things are not working for you. Update the files with the node version, and then re-run the procedure others provided in this thread. It will work. ;)

0

I had this issue for a long time while locally running a build in Docker, using a node alpine image. I was using the following to create the base layer:

FROM node:19.4-alpine3.17 AS node_base
RUN apk update && \
    apk add python3 make && \
    rm -rf /var/cache/apk/*

There was one package it was missing: g++. Changing the above to the following, did the trick for me:

FROM node:19.4-alpine3.17 AS node_base
RUN apk update && \
    apk add python3 make g++ && \
    rm -rf /var/cache/apk/*

I believe this is somehow linked with the architecture of the macbook PRO with M1 chip, and I wouldn't encounter this error in other machines, but I haven't tested.

ccoutinho
  • 3,308
  • 5
  • 39
  • 47
-1

For me, when i ran npm install it audited the installed packages and showed "found 1 high severity vulnerability" and by running

npm audit fix

did the trick. Posting if it helps someone.

Update: Sharing my error log:

ERROR in ./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/styles.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding ..\node_modules\node-sass\vendor\win32-x64-57\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 10.x

This usually happens because your environment has changed since running `npm install`.
....

It did ask me to

Run `npm rebuild node-sass` to download the binding for your current environment.
narcs
  • 213
  • 1
  • 2
  • 13
-1

Install Xcode if you are on a mac.

eomeroff
  • 9,599
  • 30
  • 97
  • 138
-2

For Mac:

  1. -CMD+SHIFT+G
  2. -/usr/local/lib/node-sass
  3. -right click and renamed: should still the same node-sass
  4. -then run: npm install node-sass -g

that fixed.

André Kool
  • 4,880
  • 12
  • 34
  • 44
sadeq alshaar
  • 673
  • 5
  • 8