NPM install on OpenShift Jenkins gear

前提是你 提交于 2020-01-13 11:27:29

问题


I (like a number of others) are struggling to get Jenkins cartridges on Openshift to play nicely with NPM. Following the advice of others on SO, I have managed to navigate the NPM cache redirection that needs to occur on Openshift as described here.

My current build script for running my node tests on Jenkins looks like this;

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

The errors I am experiencing are numerous with the killer blow stating;

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

The full output can be viewed here.

I can confirm that the script runs well (without the redirect) on my local machine running npm v1.3.24 and node v0.10.25. The Jenkins instance is running npm v2.0.0 and node v0.11.14. My next step is to upgrade my local environment to meet the Jenkins node-npm configuration and attempt to replicate locally. That said, I'm still not sure what the corrective action should be!

Any advice appreciated.

来源:https://stackoverflow.com/questions/26830194/npm-install-on-openshift-jenkins-gear

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!