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

Unable to provide NodeJS path to Jenkins plugin

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Trivial
    • Resolution: Done
    • Component/s: nodejs-plugin
    • Labels:
      None
    • Environment:
      RHEL 7.2
    • Similar Issues:

      Description

      Hi,

      I have RHEL env on which Jenkins is installed as well as NodeJS. I have the node file located in /usr/local/bin.. but when I give this same path in the NodeJS installation path of Jenkins Configure Tool section, it fails when I run the job, below is the error:

      ERROR: Couldn't find any executable in "/usr/local/bin/"
      Finished: FAILURE

      Please tell me what path needs to be given in Jenkins for NodeJS as in windows we have .exe location, in linux I could only find the location for my node as :

      whereis node
      node: /usr/bin/node /usr/local/bin/node

       

        Attachments

          Activity

          Hide
          nfalco79 Nikolas Falco added a comment -

          I image from the description you are not using the automatic installer. In this case you have to set the installation. All folders you wrote are not nodejs installation folder for sure. There is present only the link to the node executable.

          Show
          nfalco79 Nikolas Falco added a comment - I image from the description you are not using the automatic installer. In this case you have to set the installation. All folders you wrote are not nodejs installation folder for sure. There is present only the link to the node executable.
          Hide
          monali1606 Monali Chaudhary added a comment -

          I did below steps now:

          1. Downloaded the tar for nodev8.9.4
          2. Created folder nodejs under /usr/local
          3. moved the node js tar file under the nodejs folder
          4. Executed the cmd: sudo tar -C /usr/local/nodejs --strip-components 1 -xzf node-v8.9.4-linux-x64.tar.gz
          5. Linked /usr/local/bin/node to executable in /usr/local/nodejs/bin/node
          6. Updated Jenkins NOdejs Installation path --> /usr/local/nodejs/bin

          But I am still getting the same error

          $ node -v
          v8.9.4

          Show
          monali1606 Monali Chaudhary added a comment - I did below steps now: Downloaded the tar for nodev8.9.4 Created folder nodejs under /usr/local moved the node js tar file under the nodejs folder Executed the cmd: sudo tar -C /usr/local/nodejs --strip-components 1 -xzf node-v8.9.4-linux-x64.tar.gz Linked /usr/local/bin/node to executable in /usr/local/nodejs/bin/node Updated Jenkins NOdejs Installation path --> /usr/local/nodejs/bin But I am still getting the same error $ node -v v8.9.4
          Hide
          nfalco79 Nikolas Falco added a comment -

          /usr/local/nodejs is the nodejs home path

          Show
          nfalco79 Nikolas Falco added a comment - /usr/local/nodejs is the nodejs home path
          Hide
          monali1606 Monali Chaudhary added a comment -

          Correct  and I did provide this path to the Jenkins for NodeJS installation path but it is still giving me same error.

          Show
          monali1606 Monali Chaudhary added a comment - Correct  and I did provide this path to the Jenkins for NodeJS installation path but it is still giving me same error.
          Hide
          monali1606 Monali Chaudhary added a comment -

          The error is same even after updating the NodeJS installation folder /usr/local/nodejs/bin

          Show
          monali1606 Monali Chaudhary added a comment - The error is same even after updating the NodeJS installation folder /usr/local/nodejs/bin
          Hide
          nfalco Nikolas Falco added a comment - - edited

          is /usr/local/nodejs accessible by jenkins user?

          How PATH and NODEJS-HOME environment variable are setup inside a shell script step?
          Did you tick the "provide Node & npm bin/ folder to PATH" ?
          Are the node and npm command marked as executable attribute (try with 755)?

          You had wrote node is already in the your PATH so if you run from an ssh shell:
          /usr/local/bin/node -v
          or
          /usr/local/nodejs/bin/node -v
          I expect it works and wrote the version.

          In jenkins create a new Freestyle job and add a shell step that execute both command with full path, if not work than something from in Jenkins not related with nodejs plugin

          When you ask help it is useful any detailed explanation.

          Show
          nfalco Nikolas Falco added a comment - - edited is /usr/local/nodejs accessible by jenkins user? How PATH and NODEJS-HOME environment variable are setup inside a shell script step? Did you tick the "provide Node & npm bin/ folder to PATH" ? Are the node and npm command marked as executable attribute (try with 755)? You had wrote node is already in the your PATH so if you run from an ssh shell: /usr/local/bin/node -v or /usr/local/nodejs/bin/node -v I expect it works and wrote the version. In jenkins create a new Freestyle job and add a shell step that execute both command with full path, if not work than something from in Jenkins not related with nodejs plugin When you ask help it is useful any detailed explanation.
          Hide
          nfalco Nikolas Falco added a comment -

          I spent some minutes to perform a test.

          1. I have download the windows zip distribution node-v10.13.0-win-x64.zip
          2. unzip it in download folder D:\Downloads\node-v10.13.0-win-x64
          3. add a new NodeJS tool definition in Manage Jenkins installation without disabling "Automatic install" and provide D:\Downloads\node-v10.13.0-win-x64 as installation folder.
          4. Create a new Freestyle Job
          5. tick "Provide Node & npm bin/ folder to PATH"
          6. add a windows batch shell step
          7. put
            set %PATH%
            set %NODEJS_HOME%"
            node -v
            
          8. and the node executable was of the expected version 10.13.0 because I have installed in the system NodeJS 8.11.1, but the specified as jenkins tools wins over installed.
          Started by user anonymous
          Building in workspace D:\git\nodejs-plugin\work\workspace\node
          [node] $ cmd /c call C:\Users\NIKOLA~1\AppData\Local\Temp\jenkins8164397220893305286.bat
          
          D:\git\nodejs-plugin\work\workspace\node>echo C:\Program Files\Java\jdk1.8.0/bin;D:\Downloads\node-v10.13.0-win-x64;C:\Program Files\Java\jdk1.8.0/bin;C:/Program Files/Java/bin/server;C:/Program Files/Java/bin;C:/Program Files/Java/lib/amd64;C:\Program Files\Docker\Docker\Resources\bin;C:\ProgramData\Oracle\Java\javapath;D:\Programs\Python3....
          
          D:\git\nodejs-plugin\work\workspace\node>echo D:\Downloads\node-v10.13.0-win-x64 
          D:\Downloads\node-v10.13.0-win-x64
          
          D:\git\nodejs-plugin\work\workspace\node>node -v 
          v10.13.0
          
          D:\git\nodejs-plugin\work\workspace\node>exit 0 
          Finished: SUCCESS
          
          Show
          nfalco Nikolas Falco added a comment - I spent some minutes to perform a test. I have download the windows zip distribution node-v10.13.0-win-x64.zip unzip it in download folder D:\Downloads\node-v10.13.0-win-x64 add a new NodeJS tool definition in Manage Jenkins installation without disabling "Automatic install" and provide D:\Downloads\node-v10.13.0-win-x64 as installation folder. Create a new Freestyle Job tick "Provide Node & npm bin/ folder to PATH" add a windows batch shell step put set %PATH% set %NODEJS_HOME%" node -v and the node executable was of the expected version 10.13.0 because I have installed in the system NodeJS 8.11.1, but the specified as jenkins tools wins over installed. Started by user anonymous Building in workspace D:\git\nodejs-plugin\work\workspace\node [node] $ cmd /c call C:\Users\NIKOLA~1\AppData\Local\Temp\jenkins8164397220893305286.bat D:\git\nodejs-plugin\work\workspace\node>echo C:\Program Files\Java\jdk1.8.0/bin;D:\Downloads\node-v10.13.0-win-x64;C:\Program Files\Java\jdk1.8.0/bin;C:/Program Files/Java/bin/server;C:/Program Files/Java/bin;C:/Program Files/Java/lib/amd64;C:\Program Files\Docker\Docker\Resources\bin;C:\ProgramData\Oracle\Java\javapath;D:\Programs\Python3.... D:\git\nodejs-plugin\work\workspace\node>echo D:\Downloads\node-v10.13.0-win-x64 D:\Downloads\node-v10.13.0-win-x64 D:\git\nodejs-plugin\work\workspace\node>node -v v10.13.0 D:\git\nodejs-plugin\work\workspace\node>exit 0 Finished: SUCCESS

            People

            • Assignee:
              nfalco Nikolas Falco
              Reporter:
              monali1606 Monali Chaudhary
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: