jenkins+nodejs自动部署时,npm install报错问题code 1的解决办法
jenkins+nodejs自动部署时,npm install报错问题code 1 npm ERR! path /root/.jenkins/workspace/test/node_modules/deasyncError: Could not locate the bindings file. Tried:的解决办法
·
最近在搞Jenkins+nodejs,前端自动化部署时发现的问题,使用在Jenkins上使用nodejs插件,执行shell脚本实现自动化打包过程时,执行npm install出现以下报错,Windows本地执行没有问题:
npm ERR! code 1 npm ERR! path /root/.jenkins/workspace/test/node_modules/deasync npm ERR! command failed npm ERR! command sh -c node ./build.js npm ERR! `linux-x64-node-15` exists; testing npm ERR! Problem with the binary; manual build incoming npm ERR! stdout= npm ERR! err=Error: Command failed: /root/.jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/node quick-test.js npm ERR! /root/.jenkins/workspace/test/node_modules/bindings/bindings.js:135 npm ERR! throw err; npm ERR! ^ npm ERR! npm ERR! Error: Could not locate the bindings file. Tried:
原因:nodejs版本过高的兼容性问题
(题外话:按理说高版本向下兼容,不应该出现这个问题)
解决办法:将nodejs版本选择为低版本14.16.1,具体步骤如下:
选择版本,保存
再次构建
成功
尝试过的方法:
1、通过服务器安装的nodejs环境运行,结果高版本也失败;
2、执行:
npm install --save-dev electron-rebuild
npm uninstall deasync
npm install deasync
./node_modules/.bin/electron-rebuild
也一样失败
更多推荐
已为社区贡献1条内容
所有评论(0)