糟糕!堆栈错误:`C:\ Program Files(x86)\ MSBuild \ 14.0 \ bin \ msbuild.exe` [英] gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe`
问题描述
我在执行詹金斯(Jenkins)作业时遇到以下错误.我已经安装了MSBuild 15和17,并指定了正确的路径.
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)\ Jenkins \ workspace \ POS4> npm install
(x86)\Jenkins\workspace\POS4> npm install
pos4@1.0.10安装C:\ Program Files(x86)\ Jenkins \ workspace \ POS4 node-gyp重建
pos4@1.0.10 install C:\Program Files (x86)\Jenkins\workspace\POS4 node-gyp rebuild
C:\ Program Files(x86)\ Jenkins \ workspace \ POS4>如果未定义npm_config_node_gyp(节点"C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ npm-lifecycle \ node-gyp-bin \". ... \ node_modules \ node-gyp \ bin \ node-gyp.js"rebuild)else(节点" C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js重建) 警告:缺少输入文件: C:\ Program Files(x86)\ Jenkins \ workspace \ POS4 \ build .. \ build \ Release \ binding.node 一次构建一个此解决方案中的项目.要启用并行构建,请添加"/m"开关. C:\ Program Files(x86)\ Jenkins \ workspace \ POS4 \ build \ binding.vcxproj(20,3):
C:\Program Files (x86)\Jenkins\workspace\POS4>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) Warning: Missing input files: C:\Program Files (x86)\Jenkins\workspace\POS4\build..\build\Release\binding.node Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. C:\Program Files (x86)\Jenkins\workspace\POS4\build\binding.vcxproj(20,3):
错误MSB4019:导入的项目"C:\ Micr 找不到osoft.Cpp.Default.props.请确认声明中的路径正确,并且该文件 在磁盘上.
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错误!构建错误
gyp ERR! build error
gyp错误!堆栈错误:C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
失败,退出代码:1
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
failed with exit code: 1
gyp错误!堆栈在ChildProcess.onExit(C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ build.js:262:23) 糟糕!堆栈在ChildProcess.emit(events.js:182:13) 糟糕!堆栈位于Process.ChildProcess._handle.onexit(internal/child_process.js:238:12) 糟糕!系统Windows_NT 10.0.17134
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.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
推荐答案
这是在基于Windows的操作系统上构建的用户所面临的普遍问题. node-gyp
错误表示本机模块无法构建.恕我直言,根据我的经验,从来没有一个单一的答案可以直接解决这个问题.但是,如果有人遇到node-gyp
错误,我建议您遵循以下清单.您可能已经尝试过这些,但仅供参考.
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.
- 使用
npm install --global windows-build-tools
安装Windows构建工具.这将启用本机节点模块的编译,并由 felixrieseberg/windows-build-tools .生成工具包括Python和Visual C ++软件包(Python 2.7似乎是 node-gyp ) - 配置node-gyp,以使用
node-gyp configure
或node-gyp configure --msvs_version=2015
为您的项目生成适当的构建文件,因为您提到已经安装了MSBuild 15和17.最好坚持使用一个并进行配置node-gyp
对其(通过 node-gyp 可获得更多可用命令,例如rebuild
) - 确保正确设置了 Python 的
npm config
路径.如果您是手动安装构建工具或使用上述链接安装的,请确保您的npm config
指向有效的安装目录
- 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
ornode-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 configurenode-gyp
to it (Go through node-gyp for more available commands such asrebuild
) - 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 yournpm config
points to a valid installation directory
这些仅供参考,如果我遇到更多问题,我会在这里添加它们,因为在Windows计算机上玩弄
node-gyp
是我过去和目前遇到的问题.
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.
由于找不到本地绑定,通常也会由于本地节点模块(例如SQLite)引起的错误而引发此错误.
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)\ MSBuild \ 14.0 \ bin \ msbuild.exe`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!