吉普,呃!堆栈错误:`C:\程序文件(x86)\ MSBuild\12.0\bin\MSBuild.exe`失败,退出代码:1

2024-05-14 01:23:00 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行npm install时,我将面临以下错误。我找不到问题所在。

我需要一些帮助来找到这个问题。

d:\testing\node-sample-module\node_modules\ffi\node_modules\ref\node_modules\nan\nan_implementation_pre_12_inl.h(112): error C2668: 'v8::FunctionTemplate::New' :  ambiguous call to overloaded function [d:\TESTING\node-sample-module\node_modules \ffi\node_modules\ref\build\binding.vcxproj]
C:\Users\SELVA\.nw-gyp\0.8.5\deps\v8\include\v8.h(3344): could be 'v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback,v8::Handle<v8::Value>,v8::Handle<v8::Signature>,int)'
C:\Users\SELVA\.nw-gyp\0.8.5\deps\v8\include\v8.h(3343): or v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::InvocationCallback,v8::Handle<v8::Value>,v8::Handle<v8::Signature>,int)' while trying to match the argument list '(int, v8::Local<v8::Value>,    v8::Local<v8::Signature>)'

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (c:\Users\SELVA\AppData\Roaming\npm\node_modules\nw-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "c:\\Users\\SELVA\\AppData\\Roaming\\npm\\node_modules\\nw-gyp\\bin\\nw-gyp.js" "clean" "configure" "--target=0.8.5" "build" "--arch=ia32"
gyp ERR! cwd d:\TESTING\node-sample-module\node_modules\ffi\node_modules\ref
gyp ERR! node -v v0.10.35
gyp ERR! nw-gyp -v v0.12.4
gyp ERR! not ok

仅供参考,我正在使用Windows7机器。

另外,请安装以下组件:

    <> > Visual C++ +可重分配2013(32位)

  • Python 2.7.3(env变量设置为path/Python.exe)

  • Visual studio速成版2013

  • .Net框架4.5 SDK

提前谢谢。


Tags: buildmodulesnodenpmstacklocaljsusers
1条回答
网友
1楼 · 发布于 2024-05-14 01:23:00

更新:

现在一个新的包裹能帮我们完成这一切。

通过运行以下命令确保您具有足够的权限:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

然后运行:

npm install -g windows-build-tools

等待安装,然后运行:

window-build-tools

一切都应该井然有序。


旧答案:

我刚经历了一些和你一样的问题。我在Hyper-V中创建了一个新的Windows 8.1安装程序,完成了安装过程,并在很长一段时间里把事情记下来。看来你已经安装了所有必要的工具。

我认为您可能丢失的唯一想法(虽然不完全确定)可能是在运行msvs_version时设置npm install标志,所以请尝试查看这是否有帮助:

npm install --msvs_version=2013

既然我已经做了这些笔记,我不妨把它们放在这里,这样那些遇到同样问题的人可能会找到一些帮助。

我在新安装的机器上的食谱:

1)安装Node.js

2)安装git

  • 应使用管理员权限执行CLI命令
  • 从Windows命令提示符中选择“使用Git和可选的Unix工具

    • git-add-to-path

3)将npm升级到npm 3.x.x(可选步骤)

即使您刚刚安装了Node.js,也不一定意味着您在版本3中安装了npm。

  • 应使用管理员权限执行CLI命令
  • 在命令行界面中运行npm install -g npm-windows-upgrade
  • 在命令行界面中运行Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  • 在命令行界面中运行npm-windows-upgrade
  • 选择最新版本并安装
  • 当它完成安装运行npm --version并确保它以类似3.x.x的方式响应时

4)安装Python 2.7.x

  • 转到https://www.python.org/downloads
  • 单击按钮下载Python2.7.x
  • 运行安装程序。
  • 选择Install for all users-单击“下一步”。
  • 选择在C:\Python27中安装-单击“下一步”

    • python-location
  • 确保在Add python.exe to Path中选择Will be installed on local hard drive-单击“下一步”

    • python-add-to-path-01

    • python-add-to-path-02

    • python-add-to-path-03

  • 完成安装

5)使用更新4安装Visual Studio Express 2013 for Windows桌面版

即使您的系统上安装了另一个版本的Visual Studio,也要安装它。

  • 转到http://www.microsoft.com/en-gb/download/details.aspx?id=44914
  • 选择English或其他可用语言,然后单击Download
  • 选中wdexpress_full.exe,然后单击“下一步”
  • 运行下载的文件。开始安装。
  • 如果无法启动安装,则意味着您已经有了此步骤所需的工具。中止安装。

现在运行npm install --msvs_version=2013,您应该能够在没有节点gyp抛出错误的情况下到达末尾。

相关问题 更多 >