Issue using node-sass after updating NodeJS

2020-06-01 11:27发布

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

12条回答
smile是对你的礼貌
2楼-- · 2020-06-01 11:38

You can run the:

npm rebuild node-sass
查看更多
家丑人穷心不美
3楼-- · 2020-06-01 11:39

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/

查看更多
对你真心纯属浪费
4楼-- · 2020-06-01 11:42

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

npm install node-sass
查看更多
乱世女痞
5楼-- · 2020-06-01 11:48

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

查看更多
乱世女痞
6楼-- · 2020-06-01 11:48

Remove node_modules then run npm install at project root

查看更多
做个烂人
7楼-- · 2020-06-01 11:48

Instead of deleting node-Modules, running below helps:

cd <Your project path>
node node_modules/node-sass/scripts/install.js
查看更多
登录 后发表回答