VS Task Runner Explorer - Node Sass 找不到绑定 [英] VS Task Runner Explorer - Node Sass could not find a binding

查看:20
本文介绍了VS Task Runner Explorer - Node Sass 找不到绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

无法运行C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCoreGulpfile.js"...cmd.exe/c gulp --tasks-simpleC:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sasslibinding.js:15抛出新错误(errors.missingBinary());^错误:缺少绑定 C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sassvendorwin32-ia32-47inding.nodeNode Sass 找不到当前环境的绑定:Windows 32-bit with Node.js 5.x找到以下环境的绑定:- 带有 Node.js 6.x 的 Windows 64 位这通常是因为您的环境在运行 `npm install` 后发生了变化.运行 `npm rebuild node-sass` 为当前环境构建绑定.在 module.exports (C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sasslibinding.js:15:13)在对象.<匿名>(C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sasslibindex.js:14:35)在 Module._compile (module.js:397:26)在 Object.Module._extensions..js (module.js:404:10)在 Module.load (module.js:343:32)在 Function.Module._load (module.js:300:12)在 Module.require (module.js:353:17)在要求(内部/module.js:12:17)在对象.<匿名>(C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modulesgulp-sassindex.js:187:21)在 Module._compile (module.js:397:26)

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

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

所有这些数以百万计的很酷的新前端工具和库似乎极大地拓宽了出错的地方"的范围,与以前的项目相比,效率并不高.

卢克

解决方案

配置VS使用较新版本的node.

同步节点上查找 Ryan Hayes 的说明.Visual Studio 2015 的 JS 安装版本

以下是说明中的片段,以防链接失效.

<块引用>

我在 Visual Studio 之外更新了 Node.JS,但由于 VS 使用自己的安装,与任何外部安装分开,您可能会遇到 node_modules 包依赖问题,其中一个版本的 npm 安装包(这使得它依赖那个版本的 Node/npm),然后你就不能在另一个版本中运行命令(它们会中断).具体来说,我遇到了 node-sass 和 windows 绑定的问题.解决方案是将 Visual Studio 指向我已经在 Visual Studio 外部设置的 Node.JS 版本.

  1. 首先,找到你已有的 Node.js 安装并在命令行中使用.

我在 C:Program Files (x86) odejs 安装了 nodejs.

<块引用>

  1. 转到 Visual Studio 2015 中的工具 > 选项.
  2. 在此对话框中,转到项目和解决方案 > 外部 Web 工具以打开管理 VS 中使用的所有 3rd 方工具的对话框.这就是 Node.js 所指向的地方.
  3. 在 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:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCoreGulpfile.js"...
cmd.exe /c gulp --tasks-simple
C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sasslibinding.js:15
      throw new Error(errors.missingBinary());
      ^
Error: Missing binding C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sassvendorwin32-ia32-47inding.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:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sasslibinding.js:15:13)
    at Object.<anonymous> (C:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modules
ode-sasslibindex.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:DATAGitMyAppMyBiz.MyAppMyBiz.MyApp.WebsiteCore
ode_modulesgulp-sassindex.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) odejs.

  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 Task Runner Explorer - Node Sass 找不到绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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