The build shell is:
echo $PATH
which node
ls -l /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin
node -v
The result is:
/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin/node
-rwxrwxr-x 1 jenkins jenkins 30503659 Apr 4 09:01 node
lrwxrwxrwx 1 jenkins jenkins 38 Apr 9 13:09 npm -> ../lib/node_modules/npm/bin/npm-cli.js
/tmp/hudson8026342196338345661.sh: line 1: node: not found
Why cannot it find the node command?
I'm running it with docker the official jenkins image.
EDIT: jenkins:2.46.1-alpine
As suggested in issue JENKINS-34815 (NodeJS plugin unable to install global NPM packages), check you ldd -l /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_6.10.2/bin/node
See this comment:
With current docker jenkins:2.32.1-alpine and plugin nodejs:1.0 this happens again, when using node 7.4:
Alpine just can't run the binary even if it is found in PATH and is executable:
+ /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs7/bin/node -v
/var/jenkins_home/jobs/busx1/workspace@tmp/durable-a76d6fd5/script.sh: line 1: /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs7/bin/node: not found
This happens because the image doesn't contain
libstdc++.so.6
as needed by nodejs:
/lib64/ld-linux-x86-64.so.2 (0x55ae0ad53000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x55ae0ad53000)
librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x55ae0ad53000)
Error loading shared library libstdc++.so.6: No such file or directory (needed by /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs7/bin/node)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55ae0ad53000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f0ac773e000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55ae0ad53000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55ae0ad53000)
In other words, node: not found
does not mean node
is not installed (it is, it is executable and found in the $PATH
).
It means one of node
dependencies is not found.
I run the Jenkins by a docker image jenkins:2.60.3-alpine.
And I've solved this by entering the container then install node directly:
You can find your container name using:
$ docker container ls
then replace with with the real name of container,
$ docker exec -u 0 -it <container_name> bash
bash-4.3# apk add --no-cache nodejs
bash-4.3# node --version
v6.9.5
bash-4.3# npm --version
5.6.0
Finally, the job could use the node and npm both.
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