打开 Visual Studio 任务运行程序资源管理器时,gulpfile.js
加载失败,并且在“输出”窗口中发出此错误。
Failed to run "C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\lib\binding.js:15
throw new Error(errors.missingBinary());
^
Error: Missing binding C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\vendor\win32-ia32-47\binding.node
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 (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\node-sass\lib\binding.js:15:13)
at Object.<anonymous> (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\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> (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\node_modules\gulp-sass\index.js:187:21)
at Module._compile (module.js:397:26)
Running gulp
运行任务并且我的 SASS 编译良好。
我尝试重新安装节点,我也确保只有一个npm
runnable 位于 Windows 路径中,我已删除node_modules
文件夹并运行npm install
也尝试过几次npm rebuild node-sass
.
所有这些数百万个很酷的新前端工具和库似乎极大地拓宽了“可能出错的地方”的范围,与以前的项目相比,效率根本不高。
Luke
配置 VS 以使用较新版本的节点。
查找 Ryan Hayes 的说明,网址为将 Node.JS 安装版本与 Visual Studio 2015 同步 https://ryanhayes.net/synchronize-node-js-install-version-with-visual-studio-2015/
下面是说明的片段,以防链接失效。
我在 Visual Studio 之外更新了 Node.JS,但由于 VS 使用与任何外部安装分开的自己的安装,因此您可能会遇到 node_modules 包依赖性问题,其中一个版本的 npm 安装了一个包(这使得它依赖于该包) Node/npm 版本),然后您无法在其他版本中运行命令(它们会损坏)。具体来说,我遇到了 node-sass 和 windows 绑定的问题。解决方案是将 Visual Studio 指向我已经在 Visual Studio 外部设置的 Node.JS 版本。
- 首先,找到您已有的 Node.js 安装并在命令行中使用。
我已经安装了nodejsC:\Program Files (x86)\nodejs\
.
- Go to 工具 > 选项在 Visual Studio 2015 中。
- 在此对话框中,转到项目和解决方案 > 外部 Web 工具打开管理 VS 中使用的所有 3rd 方工具的对话框。这就是 Node.js 所指的地方。
- Add an entry at the top to the path to the node.js directory to force Visual Studio to use that version instead.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)