Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43593

NPM unable to locate node binary

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Build step fails when using exact syntax as the NodeJS plugin wiki page at https://plugins.jenkins.io/nodejs

      tools {
       nodejs 'name'
       }
      

      sh 'npm install' is called the output from Jenkins the result is:

       + npm install 
       env: 'node': No such file or directory 
       script returned exit code 127
      

      Docker exec on npm produces the exact same error:

       /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/npm
       env: 'node': No such file or directory
      

        Attachments

          Issue Links

            Activity

            Hide
            nfalco Nikolas Falco added a comment -

            With jenkins pipeline you can easly do a workaround, try the follow

            env.NODEJS_HOME = "${tool node7}"
            env.PATH="${env.NODEJS_HOME}:${env.PATH}"
            echo ${env.PATH}
            sh 'node -version'
            
            Show
            nfalco Nikolas Falco added a comment - With jenkins pipeline you can easly do a workaround, try the follow env.NODEJS_HOME = "${tool node7}" env.PATH= "${env.NODEJS_HOME}:${env.PATH}" echo ${env.PATH} sh 'node -version'
            Hide
            mrmarc Marc Smith added a comment -

            Since this is still a problem in the official Jenkins/BlueOcean can we reopen this? this is a critical bug for anyone using npm.

            Show
            mrmarc Marc Smith added a comment - Since this is still a problem in the official Jenkins/BlueOcean can we reopen this? this is a critical bug for anyone using npm.
            Hide
            mrmarc Marc Smith added a comment - - edited

            Hi Nikolas,

            This is not fixed in the jenkinsci/blueocean image on docker hub. Your instructions to reproduce require downloading a .war file and running directly from java. This defeats the purpose of having the jenkinsci/blueocean image on docker.   Please reproduce/fix the issue using the official jenkinsci/blueocean on an Ubuntu 16.04 LTS machine. Thank you!

            Show
            mrmarc Marc Smith added a comment - - edited Hi Nikolas, This is not fixed in the jenkinsci/blueocean image on docker hub. Your instructions to reproduce require downloading a .war file and running directly from java. This defeats the purpose of having the jenkinsci/blueocean image on docker.   Please reproduce/fix the issue using the official jenkinsci/blueocean on an Ubuntu 16.04 LTS machine. Thank you!
            Hide
            nfalco Nikolas Falco added a comment - - edited

            Hi the docker image is out the scope of the plugin and with other maintainers.
            I had a look on the docker image (it is not a Ubuntu but an alpine image JAVA_ALPINE_VERSION='8.181.13-r0').

            • the PATH environment variable is correctly setup PATH='/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_10/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'
            • the node is download and place in the correct folder and the bin folder have the execute (+x) attribute setup correctly

            anyway the node command does not work, not only in jenkins but also if you run the node command from a shell it give the same error.

            I had a look around and seems the alpine image have a limited symbolic library needed by nodejs. The official nodejs image does not use the distribution archive but compile in place the source code. This could not be done by the plugin

            Show
            nfalco Nikolas Falco added a comment - - edited Hi the docker image is out the scope of the plugin and with other maintainers. I had a look on the docker image (it is not a Ubuntu but an alpine image JAVA_ALPINE_VERSION='8.181.13-r0' ). the PATH environment variable is correctly setup PATH='/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node_10/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' the node is download and place in the correct folder and the bin folder have the execute (+x) attribute setup correctly anyway the node command does not work, not only in jenkins but also if you run the node command from a shell it give the same error. I had a look around and seems the alpine image have a limited symbolic library needed by nodejs . The official nodejs image does not use the distribution archive but compile in place the source code . This could not be done by the plugin
            Hide
            ampc António Carvalho added a comment -

            I had this error too when creating a pipeline using nodejs. Maybe the tutorials should be updated if the `jenkins/blueocean` image have these problems. https://jenkins.io/doc/book/blueocean/getting-started/#as-part-of-jenkins-in-docker

            Show
            ampc António Carvalho added a comment - I had this error too when creating a pipeline using nodejs. Maybe the tutorials should be updated if the `jenkins/blueocean` image have these problems.  https://jenkins.io/doc/book/blueocean/getting-started/#as-part-of-jenkins-in-docker

              People

              Assignee:
              nfalco Nikolas Falco
              Reporter:
              whytoe Dan Woytowich
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: