25

I get an issue using node-sass after updating my NodeJS version.

Issue :

(node:472) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
C:\aglqng\src\main\webapp\node_modules\node-sass\lib\index.js:15
    throw new Error(errors.missingBinary());
    ^

Error: Missing binding C:\aglqng\src\main\webapp\node_modules\node-sass\vendor\win32-x64-48\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x

Found bindings for the following environments:
  - Windows 64-bit with Node 0.12.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 Object.<anonymous> (C:\aglqng\src\main\webapp\node_modules\node-sass\lib\index.js:15:11)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\aglqng\src\main\webapp\node_modules\gulp-sass\index.js:187:21)
    at Module._compile (module.js:541:32)

Versions :

node-sass 3.8.0 (Wrapper) [JavaScript]
libsass 3.3.6 (Sass Compiler) [C/C++]
nodejs v6.3.1

Platform : Windows 10 x64

I tried this and it doesn't work :

1)

node rebuild node-sass

2)

npm uninstall node-sass
npm i node-sass
tonymx227
  • 5,293
  • 16
  • 48
  • 91

12 Answers12

34

I was able to fix this issue by just running this command:

npm install node-sass
Tonechas
  • 13,398
  • 16
  • 46
  • 80
Scott
  • 805
  • 7
  • 19
24

If the rebuild command didn't work for you, try deleting the "node_modules" directory and reinstall.

nschonni
  • 4,069
  • 1
  • 28
  • 37
14

You can run the:

npm rebuild node-sass
cramopy
  • 3,459
  • 6
  • 28
  • 42
Vinod Kumar
  • 1,191
  • 14
  • 12
9

I encountered the issue when I updated to VS 2017. VS comes with its own installation of Node, which might not be the most updated one that exists on your system. To override this follow the following steps:

  1. Go to Tools -> Options -> Project and Solutions -> Web Package Management
  2. In "Location of External Tools" Add a new entry which points to nodejs install location, like: "C:\Program Files\nodejs"
  3. Make sure it is above other entries.

I found a really helpful article here, which informed me on above points.

[Note: If needed, first update nodejs on your system. On windows, this is done by making a fresh install of new version.]

Blaze
  • 1,642
  • 2
  • 22
  • 20
3

Remove node_modules then run npm install at project root

abelabbesnabi
  • 1,819
  • 1
  • 16
  • 21
2

this works for me: Synchronize Node.JS Install Version with Visual Studio 2015

1) find the Node.js installation you already have and use at the command line. By default, Node.js 0.12.7 installs to “C:\Program Files\nodejs”, as an FYI.

2) Once you’ve got that all copied out to your clipboard, got to Tools > Options in Visual Studio 2015. In this dialog, go to Projects and Solutions > External Web Tools to open the dialog that manages all of the 3rd party tools used within VS. This is where Node.js is pointed to.

3)Add an entry at the top to the path to the node.js directory to force Visual Studio to use that version instead.

thanks to: https://ryanhayes.net/synchronize-node-js-install-version-with-visual-studio-2015/

Brandy23
  • 269
  • 2
  • 8
2

Instead of deleting node-Modules, running below helps:

cd <Your project path>
node node_modules/node-sass/scripts/install.js
E. Zeytinci
  • 2,642
  • 1
  • 20
  • 37
Anusuya Goud
  • 161
  • 2
  • 9
1

I had the same issue on windows, I have solved it by doing the following:

  1. open terminal as administrator

  2. run npm rebuild node-sass

  3. run npm ci

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
itay oded
  • 978
  • 13
  • 22
1

I have this error when code repository is originally complied in macOS Mojave, and run it on Windows 10.

Just use following command to fix this error:

npm rebuild node-sass

After run the command, then run ng serve again.

Jerry Chong
  • 7,954
  • 4
  • 45
  • 40
1

Some versions of node-sass are not compatible with certain versions of Node. After I upgraded my Node to version 12, I had to upgrade the version of node-sass in my project to 4.12 using this command:

npm install node-sass@4.12.0

This page shows the version compatibilities:

https://www.npmjs.com/package/node-sass

John Gilmer
  • 831
  • 1
  • 11
  • 18
0

I had the same issure as your. When I used npm rebuild node-sass, it was still failed, the error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT HON env variable.

I searched the error message, some npm plugins need node-gyp to be installed. However, node-gyp has it's own dependencies.node-gyp

On Windows
Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

npm install --global --production windows-build-tools

and then install the package

npm install --global node-gyp

That's it, run npm rebuild node-sass again, and it's worked!

Annual
  • 1
  • 1
  • I did this install on an machine and there is one problem with it that I didn't expect. We have VS2017 already installed. The package installs the VS build tools anyways. Normally this shouldn't be a problem except that some build tools search for VS versions now think the build tools folder is a full install. For most build actions this will work. But we have builds that require a full install. (Code coverage for instance). Maybe best to just install Python manually on those systems – Schwarzie2478 Nov 27 '18 at 13:54
0

If the issue still prevails after running npm rebuild node-sass, follow as below

  1. delete node_modules folder
  2. run 'npm install',
  3. npm rebuild node-sass,
  4. run command for respective environment.
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140