更新NodeJS后使用node-sass发出问题

ton*_*227 12 node.js node-sass

node-sass更新我的NodeJS版本后,我遇到了一个问题.

问题 :

(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)
Run Code Online (Sandbox Code Playgroud)

版本:

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

平台: Windows 10 x64

我尝试过这个并不起作用:

1)

node rebuild node-sass
Run Code Online (Sandbox Code Playgroud)

2)

npm uninstall node-sass
npm i node-sass
Run Code Online (Sandbox Code Playgroud)

Sco*_*ott 19

我只需运行此命令就可以解决此问题:

npm install node-sass
Run Code Online (Sandbox Code Playgroud)


nsc*_*nni 17

如果rebuild命令不适合您,请尝试删除"node_modules"目录并重新安装.

  • 好吧,它没有帮助我 (3认同)
  • 我可以确认这对我也有用.不需要卸载或升级`node-sass`(re:tonymx227的编辑和明显的第二次尝试). (2认同)

Vin*_*mar 9

你可以运行:

npm rebuild node-sass
Run Code Online (Sandbox Code Playgroud)


Bla*_*aze 5

我在更新到VS 2017时遇到了这个问题.VS带有自己的Node安装,可能不是系统中最新的.要覆盖此操作,请执行以下步骤:

  1. 转到工具 - >选项 - >项目和解决方案 - > Web包管理
  2. 在"外部工具的位置"中添加一个指向nodejs安装位置的新条目,如:"C:\ Program Files \nodejs"
  3. 确保它高于其他条目.

我在这里找到了一篇非常有用的文章,它告诉了我以上几点.

[注意:如果需要,首先更新系统上的nodejs.在Windows上,这是通过全新安装新版本来完成的.