I am trying to run webdriverio test from jenkins and following this . I installed nodeJS
plugin for jenkins and under global tool config, for NodeJS , added a name and installation directory as /usr/local/bin
(node executable is in this folder)
In Jenkins, in project config , under build environment, I have checked
Provide Node & npm bin/ folder to PATH
and chosen the node installation name from previous step
But when I am trying to run npm install
npm test
,by adding these commands under execute shell under Build and building it, I receive this error
Building in workspace /Users/Shared/Jenkins/Home/workspace/wdio-project
[wdio-project] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson1478028169114509075.sh
+ npm install
/Users/Shared/Jenkins/tmp/hudson1478028169114509075.sh: line 2: npm: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
In case someone is looking for same issue, I resolved the above error by adding export PATH=/usr/local/bin
to the execute shell under build. This post helped me
There is currently a bug opened about this (JENKINS-26583 and JENKINS-27170)
I could workaround this bug by adding explicitly node on the PATH by adding this line :
export PATH=$PATH:/home/jenkins/.jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_js/bin/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With