Edw*_*way 11 msbuild node.js npm jenkins npm-install
运行 Jenkins 作业时出现以下错误。我已经安装了 MSBuild 15 和 17 并指定了正确的路径。
Can anyone shed some light on this? Where the issue is. Thanks.
(x86)\Jenkins\workspace\POS4> npm install
pos4@1.0.10 install C:\Program Files (x86)\Jenkins\workspace\POS4 node-gyp rebuild
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):
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)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
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
小智 12
确保您没有使用 Node 12,因为 node-gyp 将失败。版本 11.15.0 是最新的工作版本。
这是在基于 Windows 的操作系统上构建的用户面临的一个非常普遍的问题。一个node-gyp错误意味着本机模块未能建立。恕我直言,根据我的经验,从来没有一个答案可以直接解决这个问题。但是,如果其他人遇到node-gyp错误,我建议您遵循以下清单。您可能已经尝试过这些,但只是将其留作参考。
npm install --global windows-build-tools. 这将启用本地节点模块的编译,由felixrieseberg/windows-build-tools 提供。构建工具包括 Python 和 Visual C++ 包等项目(Python 2.7 似乎是node-gyp的首选)node-gyp configure或node-gyp configure --msvs_version=2015在您的情况下为您的项目生成适当的构建文件,因为您提到您已经安装了 MSBuild 15 和 17。最好坚持使用一个并配置node-gyp它(通过node-gyp获取更多可用的命令,例如rebuild)npm config的Python路径设置正确。如果您手动安装了构建工具或使用上面提到的链接,请确保您npm config指向有效的安装目录
这些仅供参考,如果我遇到更多,我会在这里添加它们,因为
node-gyp在 Windows 机器上玩杂耍是我过去和现在遇到的麻烦。
由于无法找到本机绑定,因此本机节点模块(例如 SQLite)导致的错误通常也会引发此错误。
尝试将您的 Node 版本降级到 11.15.0,因为它是最新的工作版本,您可以使用 n 进行 node 的版本管理。n 有一个简单的介绍。
$ npm install -g n
$ n 6.10.3
Run Code Online (Sandbox Code Playgroud)
这很容易使用。
然后你可以显示你的节点版本:
$ node -v
$ v8.11.1
Run Code Online (Sandbox Code Playgroud)
检查这个答案
| 归档时间: |
|
| 查看次数: |
15138 次 |
| 最近记录: |