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

更新我的NodeJS版本后,我得到了一个使用node-sass的问题。

问题 :

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

版本:

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

平台: Windows 10 x64

我试过这个,它不工作:

1)

 node rebuild node-sass 

2)

 npm uninstall node-sass npm i node-sass 

如果重build命令不适合您,请尝试删除“node_modules”目录并重新安装。

当我更新到VS 2017时,我遇到了这个问题。VS带有自己安装的节点,它可能不是系统中存在的最新的节点。 要覆盖这个请按照以下步骤:

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

我在这里find了一篇非常有用的文章,它向我通报了以上几点。

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

我能够通过运行这个命令来解决这个问题:

 npm install node-sass 

这适用于我:同步Node.JS安装版本与Visual Studio 2015

1)find你已经有的Node.js安装,并在命令行中使用。 默认情况下,Node.js 0.12.7作为FYI安装到“C:\ Program Files \ nodejs”。

2)将所有内容复制到剪贴板后,转到Visual Studio 2015中的“工具”>“选项”。在此对话框中,转至“项目和解决scheme”>“外部Web工具”以打开pipe理所有第三方工具的对话框在VS中使用。 这是Node.js指向的地方。

3)将顶部条目添加到node.js目录的path,以强制Visual Studio使用该版本。

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

删除node_modules,然后在项目根目录下运行npm install

你可以运行:

 npm rebuild node-sass