吉普错误!堆栈错误:`C:Program Files (x86)MSBuild14.0inmsbuild.exe` [英] gyp ERR! stack Error: `C:Program Files (x86)MSBuild14.0inmsbuild.exe`

查看:28
本文介绍了吉普错误!堆栈错误:`C:Program Files (x86)MSBuild14.0inmsbuild.exe`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行 Jenkins 作业时遇到以下错误.我已经安装了 MSBuild 15 和 17 并指定了正确的路径.

任何人都可以对此有所了解吗?问题出在哪里.谢谢.

(x86)JenkinsworkspacePOS4> npm 安装

<块引用>

pos4@1.0.10 安装 C:Program Files (x86)JenkinsworkspacePOS4节点gyp重建

C:Program Files (x86)JenkinsworkspacePOS4>如果未定义 npm_config_node_gyp (node "C:Program Files odejs ode_modules pm ode_modules pm-lifecycle ode-gyp-bin.... ode_modules ode-gypin ode-gyp.js" 重建) else (节点 "C:Program Files odejs ode_modules pm ode_modules ode-gypin ode-gyp.js"重建)警告:缺少输入文件:C:Program Files (x86)JenkinsworkspacePOS4uild..uildReleaseinding.node一次在此解决方案中构建项目.要启用并行构建,请添加/m"开关.C:Program Files (x86)JenkinsworkspacePOS4uildinding.vcxproj(20,3):

错误 MSB4019:导入的项目C:Microsoft.Cpp.Default.props" 未找到.确认声明中的路径正确,并且该文件存在于磁盘上.

gyp 错误!构建错误

gyp 错误!堆栈错误:C:Program Files (x86)MSBuild14.0inmsbuild.exe 失败,退出代码:1

gyp 错误!ChildProcess.onExit 处的堆栈(C:Program Files odejs ode_modules pm ode_modules ode-gyplibuild.js:262:23)吉普错误!ChildProcess.emit (events.js:182:13) 的堆栈吉普错误!堆栈在 Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)吉普错误!系统 Windows_NT 10.0.17134

解决方案

这是在基于 Windows 的操作系统上构建的用户所面临的相当普遍的问题.node-gyp 错误意味着本地模块无法构建.恕我直言,根据我的经验,从来没有一个单一的答案可以直接解决这个问题.但是,如果其他人遇到 node-gyp 错误,我建议遵循以下清单.您可能已经尝试过这些,但只是将其留作参考.

  • 使用 npm install --global windows-build-tools 安装 Windows 构建工具.这将启用本机节点模块的编译,并由 felixrieseberg/windows-build-tools 提供.构建工具包括 Python 和 Visual C++ 包(Python 2.7 似乎是 node-gyp)
  • 配置 node-gyp 以在您的情况下使用 node-gyp configurenode-gyp configure --msvs_version=2015 为您的项目生成适当的构建文件,因为您提到您已经安装了 MSBuild 15 和 17.最好坚持使用并为其配置 node-gyp (通过 node-gyp 查看更多可用命令,例如 rebuild)
  • 确保 Pythonnpm config 路径设置正确.如果您手动安装了构建工具或使用上述链接,请确保您的 npm config 指向有效的安装目录<块引用>

    这些仅供参考,如果我遇到任何问题,我会在此处添加它们,因为在 Windows 机器上处理 node-gyp 是我过去和现在都遇到过的问题.

<块引用>

由于无法找到本机绑定,因此本机节点模块(例如 SQLite)导致的错误通常也会引发此错误.

I'm getting the following error when I run my Jenkins job. I've installed MSBuild 15 and 17 and specified the correct path.

Can anyone shed some light on this? Where the issue is. Thanks.

(x86)JenkinsworkspacePOS4> npm install

pos4@1.0.10 install C:Program Files (x86)JenkinsworkspacePOS4 node-gyp rebuild

C:Program Files (x86)JenkinsworkspacePOS4>if not defined npm_config_node_gyp (node "C:Program Files odejs ode_modules pm ode_modules pm-lifecycle ode-gyp-bin.... ode_modules ode-gypin ode-gyp.js" rebuild ) else (node "C:Program Files odejs ode_modules pm ode_modules ode-gypin ode-gyp.js" rebuild ) Warning: Missing input files: C:Program Files (x86)JenkinsworkspacePOS4uild..uildReleaseinding.node Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. C:Program Files (x86)JenkinsworkspacePOS4uildinding.vcxproj(20,3):

error MSB4019: The imported project "C:Micr osoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

gyp ERR! build error

gyp ERR! stack Error: C:Program Files (x86)MSBuild14.0inmsbuild.exe failed with exit code: 1

gyp ERR! stack at ChildProcess.onExit (C:Program Files odejs ode_modules pm ode_modules ode-gyplibuild.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12) gyp ERR! System Windows_NT 10.0.17134

解决方案

This is quite a common issue faced by users who build on a Windows based operating system. A node-gyp error means that a native module has failed to build. IMHO there has never been one single answer that has directly solved this issue in my experience. However below is a checklist I would suggest to follow if anyone else comes across node-gyp errors. You may have already tried these but just leaving it for reference.

  • Install windows build tools using npm install --global windows-build-tools. This will enable compiling of native node modules and is courtesy of felixrieseberg/windows-build-tools. Build tools include items like Python and Visual C++ packages (Python 2.7 seems to be the preferred one by node-gyp)
  • Configure node-gyp to generate the appropriate build files for your project using node-gyp configure or node-gyp configure --msvs_version=2015 in your case since you mentioned that you have installed a MSBuild 15 and 17. It would be better to stick to one and configure node-gyp to it (Go through node-gyp for more available commands such as rebuild)
  • Ensure your npm config path for Python is set correctly. If you installed the build tools manually or using the link mentioned above ensure that your npm config points to a valid installation directory

    These are just for reference and if I come across any more I will add them here as juggling node-gyp on Windows machines is something I have had trouble in the past and currently.

This error is also commonly thrown for errors caused by native node modules such as SQLite since native bindings are unable to be found.

这篇关于吉普错误!堆栈错误:`C:Program Files (x86)MSBuild14.0inmsbuild.exe`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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