wedriverio jenkins - npm command not found error
Solution 1
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
Solution 2
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/
user1207289
Updated on June 20, 2022Comments
-
user1207289 almost 2 years
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 stepBut 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 errorBuilding 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