【问题标题】:Error when using npm with Visual Studio 2015在 Visual Studio 2015 中使用 npm 时出错
【发布时间】:2016-09-01 08:38:39
【问题描述】:

我正在尝试使用 Visual Studio 2015 运行 Angular2 项目。当我通过 Windows 控制台命令“npm start”使用 npm 启动该项目时,该项目完美运行。

我尝试使用 npm Task Runner for VS 做同样的事情,但出现此错误:

ERROR in Missing binding C:\Projets\BONewArchi\WebPack\node_modules\node-sass\vendor\win32-ia32-47\binding.node

浏览器还会显示以下消息:

Missing binding C:\Projets\BONewArchi\WebPack\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 4.x

我该如何解决?

编辑:重要的精度:项目使用 webpack

【问题讨论】:

    标签: angular visual-studio-2015 npm webpack


    【解决方案1】:

    Visual Studio 附带的 Node/NPM 版本(当您在 Visual Studio 中运行任务时运行的版本)非常旧,因此绑定与通过命令行安装时的绑定不同。

    使用右上角的快速启动工具栏,键入“外部网络工具”,将弹出一个对话框。在此处创建一个指向全局节点路径的新条目(可能在 c:\Program Files\nodejs 中)并将其移至列表顶部。关闭 Visual Studio,删除 node_modules,然后再次打开解决方案。

    如果这不起作用,请检查您正在运行的节点和 NPM 版本。

    【讨论】:

      【解决方案2】:

      我已经删除了 node_module 中的所有内容,然后使用 npm Task Runner 重新安装它,它可以工作

      【讨论】:

      • 为了更清楚地说明这一点,VS2015 仅在 x32 中可用。 node-sass 有一个 at install 编译器,可以为您的环境运行和重新编译它。如果您使用 NPM 处理程序中内置的 VS2015s 运行安装,它会将其编译到 32x,但如果您使用任何 64x 运行 npm install,它将为此重新编译。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-22
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多