Mik*_*ole 6 node.js gulp visual-studio-2017
我正在尝试将gulp集成到Visual Studio 2017中.它正在命令行上工作.VS2017中的Task Runner Explorer告诉我Failed to load. See output window.
输出窗口告诉我以下内容:
Failed to run "<ProjectPath>\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
<ProjectPath>\node_modules\node-sass\lib\binding.js:15
throw new Error(errors.missingBinary());
^
Error: Missing binding <ProjectPath>\node_modules\node-sass\vendor\win32-x64-47\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 5.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 8.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
Run Code Online (Sandbox Code Playgroud)
我试图跑 npm rebuild node-sass --force,只是被告知Error: Can't find Python executable "C:\Python36\python.EXE", you can set the PYTHON env variable.,我确认存在.
我不确定我想要走多远这个兔子洞.它似乎是一个VS问题,因为一切都在命令行上按预期工作.我希望与VS正常工作的gulp集成.
scn*_*iro 18
将VS工具指向路径上的节点安装.
我可以在错误中看到,5.x和之间存在版本差异8.x- 与VS可能是较旧的版本(因为它附带预打包和过时的节点)并且正在使用默认设置执行优先级.
我猜你是node-sass通过你的8.x(外部命令行)实例安装的,但是VS试图通过你的VS内部执行你的gulp任务5.x.node-sass利用node-gyp通过安装脚本构建二进制文件,并且不同版本之间存在不兼容性.换句话说,这个包以及许多其他构建二进制文件的包都是专门针对它所安装的节点版本而定制的.总而言之,所有内容node_modules/.bin都是针对构建的,8.x但实际上是5.x通过Visual Studio运行的.
不要害怕,这很容易解决.查看这个答案,了解许多人面临的这个长期存在的问题的历史背景.基本上,您希望$(PATH)位于此列表的顶部,以便始终使用您的操作系统安装...
一旦你这样做(只是为了安全) - 吹走node_modules,重新安装和快乐编码.VS确实需要停止使用固定版本的节点发货...