721

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?

10
  • 19
    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 Jun 23, 2016 at 9:06
  • 3
    Hey im not using nvm and I tried the removal/re-install step. no luck.
    – wazzaday
    Jun 23, 2016 at 9:17
  • what is your development environment? you use VS.NET 2105? Dec 9, 2016 at 13:38
  • @VasilDininski I'm using nvm, what should I do? Apr 25, 2017 at 6:12
  • 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 May 4, 2019 at 10:55

63 Answers 63

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).
2

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

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

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.

2

Just run the comment thats it.

npm rebuild node-sass

enjoy your coding...

2
  • 1
    The OP said he tried that and it didn't work. And so did I, and it didn't work for me either. Instead I had to downgrade the version of node I was running. May 25, 2020 at 17:01
  • Actually not on linux ubuntu 20.04. Jan 31, 2021 at 12:02
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
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.

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

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.

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!

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"
1
  • 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 1, 2023 at 0:40
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.

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.

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.

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.

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
  • 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, 2019 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>
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.

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...

1
  • Actually not on linux ubuntu 20.04 . Jan 31, 2021 at 11:55
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.

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.

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.

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 [email protected] --force.Node version 10.0.0. Only working way for me.

0

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

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

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 !

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

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.