VS任务运行器资源管理器 - 节点Sass无法找到绑定 [英] VS Task Runner Explorer - Node Sass could not find a binding

查看:844
本文介绍了VS任务运行器资源管理器 - 节点Sass无法找到绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开Visual Studio Task Runner Explorer时, gulpfile.js 无法加载,并且在输出窗口中发出此错误。

 无法运行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\\\
ode_modules\\\
ode -sass\lib\binding.js:15
抛出新的Error(errors.missingBinary());
^
错误:缺少绑定C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\\\
ode_modules\\\
ode-sass\vendor\win32 -ia32-47\binding.node
节点Sass无法为您当前的环境找到绑定:Windows 32位与Node.js 5.x
找到以下环境的绑定:
- 带有Node.js的Windows 64-bit 6.x
这通常是因为在运行`npm install`后环境发生了变化。
运行`npm rebuild node-sass`为您当前的环境构建绑定。
at module.exports(C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\\\
ode_modules\\\
ode-sass\lib\binding.js:15 :13)
在Object。< anonymous> (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\\\
ode_modules\\\
ode-sass\lib\index.js:14:35)
at Module._compile(module.js:397:26)
在Object.Module._extensions..js(module.js:404:10)
在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)
在Object。< anonymous> (C:\DATA\Git\MyApp\MyBiz.MyApp\MyBiz.MyApp.WebsiteCore\\\
ode_modules\gulp-sass\index.js:187:21)
在Module._compile (module.js:397:26)

运行 gulp 运行任务,我的SASS编译正常。

我试过重新安装节点,我也确保只有一个 npm runnable在Windows路径中,我已经删除了 node_modules 文件夹并且几次运行 npm install 还尝试了 npm重建node-sass



所有这些数百万个酷酷的新前端工具和库似乎与以前的项目相比,它极大地拓宽了出错的事情的表面,而且效率不高。



Luke

解决方案

配置VS使用更新版本的节点。

https://ryanhayes.net/synchronize-node-js-install-version -with-visual-studio-2015 /rel =noreferrer>使用Visual Studio 2015同步Node.JS安装版本




我在Visual Studio之外更新了Node.JS,但是由于VS使用自己的独立安装从任何外部安装中,您可能会遇到node_modules程序包依赖性问题,其中一个版本的npm安装程序包(这使得它依赖于该版本的Node / npm),然后您无法在其他版本中运行命令(他们打破)。具体来说,我遇到了node-sass和windows绑定的问题。解决方案是将Visual Studio指向我已经在Visual Studio外部设置的Node.JS版本。首先,找到您已经拥有并在命令行中使用的Node.js安装。

$ b



我已经在 C:\ Program Files(x86)\\\
odejs\ $ b



  1. 转到工具>选项在此对话框中,转至项目和解决方案>外部Web工具以打开管理所有第三方工具的对话框。 VS.这是指向Node.js的地方。

  2. 在顶部添加一个条目到node.js目录的路径,以强制Visual Studio使用该版本。



When opening the Visual Studio Task Runner Explorer, the gulpfile.js fails to load and this error is emitted in the Output window.

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 runs the tasks and my SASS compiles fine.

I tried reinstalling node, I have also ensured only one npm runnable is in the Windows path and I've deleted the node_modules folder and run npm install a few times, also tried npm rebuild node-sass.

All these millions of cool new front-end tools and libraries seem to be hugely broadening the surface of "things to go wrong", not very productive at all compared to previous projects.

Luke

解决方案

Configure VS to use the newer version of node.

Find instructions by Ryan Hayes at Synchronize Node.JS Install Version with Visual Studio 2015

Snippets from the instructions are below in case the link goes stale.

I updated Node.JS outside of Visual Studio, but since VS uses its own install that is separate from any outside installation, you can potentially run into a node_modules package dependency issue where one version of npm installs a package (which makes it rely on that version of Node/npm), and then you can’t run commands in the other version (they break). Specifically, I had an issue with node-sass and windows bindings. The solution was to point Visual Studio to the version of Node.JS that I had already set up externally to Visual Studio.

  1. First, find the Node.js installation you already have and use at the command line.

I had installed nodejs at C:\Program Files (x86)\nodejs\.

  1. Go to Tools > Options in Visual Studio 2015.
  2. 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.

这篇关于VS任务运行器资源管理器 - 节点Sass无法找到绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆