I (like many others) struggle to get Jenkins cartridges on Openshift to play well with NPM. Following the advice of other SO experts, I was able to move on to redirecting the NPM cache, which should happen in Openshift, as described here .
My current build script for running my Jenkins node tests is as follows:
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 mistakes that I experience are numerous when it comes to the killer;
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
Full output can be viewed here .
, script ( ) , npm v1.3.24 node v0.10.25. Jenkins npm v2.0.0 node v0.11.14. - , Jenkins node -npm . , , !
.