我(和其他一些人一样)正努力让Openshift上的Jenkins墨盒与NPM很好地配合。根据其他人对SO的建议,我设法导航了需要在Openshift上进行的NPM缓存重定向,如here所述。
我在Jenkins上运行节点测试的当前构建脚本如下所示;
npm --version
node --version
echo "Reconfiguring the NPM cache..."
rm -rf app-root/build-dependencies/.npmrc
mkdir -p app-root/build-dependencies/.npmrc
export NPM_CONFIG_USERCONFIG=$OPENSHIFT_HOMEDIR/app-root/build-dependencies/.npmrc
rm -rf app-root/build-dependencies/.npm
mkdir -p app-root/build-dependencies/.npm
npm config set cache app-root/build-dependencies/.npm
echo "Running build..."
cd OceanLifeAPI
npm install
npm test
我遇到的错误很多,其中有一个致命的打击声;
make: *** [Release/obj.target/protagonist/src/annotation.o] Error 1
make: Leaving directory `/var/lib/openshift/53e7537ee0b8cd3172000dda/app-root/runtime/repo/OceanLifeAPI/node_modules/dredd/node_modules/protagonist/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/var/lib/openshift/53e7537ee0b8cd3172000dda/app-root/data/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/AutoInstaller/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1059:12)
gyp ERR! System Linux 2.6.32-431.29.2.el6.x86_64
gyp ERR! command "node" "/var/lib/openshift/53e7537ee0b8cd3172000dda/app-root/data/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/AutoInstaller/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/lib/openshift/53e7537ee0b8cd3172000dda/app-root/runtime/repo/OceanLifeAPI/node_modules/dredd/node_modules/protagonist
gyp ERR! node -v v0.11.14
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Linux 2.6.32-431.29.2.el6.x86_64
npm ERR! argv "/var/lib/openshift/53e7537ee0b8cd3172000dda/app-root/data/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/AutoInstaller/bin/node" "/var/lib/openshift/53e7537ee0b8cd3172000dda/app-root/data/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/AutoInstaller/bin/npm" "install"
npm ERR! node v0.11.14
npm ERR! npm v2.0.0
npm ERR! code ELIFECYCLE
npm ERR! sleep@1.1.8 install: `node build.js || nodejs build.js`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the sleep@1.1.8 install script.
npm ERR! This is most likely a problem with the sleep package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js || nodejs build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls sleep
npm ERR! There is likely additional logging output above.
Build step 'Execute shell' marked build as failure
Archiving artifacts
Finished: FAILURE
可以查看完整输出here。
我可以在运行npm v1.3.24和node v0.10.25的本地计算机上确认脚本运行良好(没有重定向)。 Jenkins实例正在运行npm v2.0.0和node v0.11.14。我的下一步是升级本地环境以满足Jenkins node-npm配置并尝试在本地复制。那就是说,我仍然不确定纠正措施应该是什么!
任何建议表示赞赏。