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

Correct path for installation is not provided to system/shells (build.steps)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: nodejs-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.44 on CentOS6, CentOS slave
    • Similar Issues:

      Description

      I have installed version 1.0.1 of this plugin
      The installation of node and also of configured modules works good. But if I add an additional build-step with executing shell, the npm command is not found.
      With version 0.2.2 this is working.

        Attachments

        1. build_output.txt
          13 kB
        2. config.xml
          7 kB
        3. nodejs_setup.png
          nodejs_setup.png
          225 kB
        4. Screen Shot 2017-02-11 at 4.06.29 PM.png
          Screen Shot 2017-02-11 at 4.06.29 PM.png
          176 kB

          Activity

          Hide
          adamdille Adam Dille added a comment -

          Strangely, the custom plugin from d6c6db7 seems to be working on our builds that run on Windows slaves, but the OSX slave, which worked fine on 0.2.2 is the one with the issue in the attached files above.

          Show
          adamdille Adam Dille added a comment - Strangely, the custom plugin from d6c6db7 seems to be working on our builds that run on Windows slaves, but the OSX slave, which worked fine on 0.2.2 is the one with the issue in the attached files above.
          Hide
          nfalco Nikolas Falco added a comment - - edited

          If Windows and Mac are slaves, on which OS run Jenkins master (just to reproduce your scenario)?
          And if works on windows slave do you have customise some node properties for mac node?
          To do this go to "Manage Jenkins" -> "Manage Nodes" -> select mac node -> configure and see if under Node Properties section Environment variables is checked and the variable PATH is setup there

          That I can see on windows slave you had install a nodejs in the system, so nodejs executable could be always available. To compare behavior windows vs mac node you should select a NodeJS version different than installed in (C:\Program Files\nodejs) and add to shell

          npm --version
          

          command to ensure that you are using the NodeJS of the selected tools and not that one installed in the system.

          Show
          nfalco Nikolas Falco added a comment - - edited If Windows and Mac are slaves, on which OS run Jenkins master (just to reproduce your scenario)? And if works on windows slave do you have customise some node properties for mac node? To do this go to "Manage Jenkins" -> "Manage Nodes" -> select mac node -> configure and see if under Node Properties section Environment variables is checked and the variable PATH is setup there That I can see on windows slave you had install a nodejs in the system, so nodejs executable could be always available. To compare behavior windows vs mac node you should select a NodeJS version different than installed in (C:\Program Files\nodejs) and add to shell npm --version command to ensure that you are using the NodeJS of the selected tools and not that one installed in the system.
          Hide
          adamdille Adam Dille added a comment -

          The master is running on Windows Server 2012 R2. None of the remote slaves have any custom node properties, including the mac.

          Our newest Windows slave doesn't have Node installed on the system at all, since I was using the NodeJS Plugin as a way to reduce that install requirement. That's the slave that is working fine with the custom built workaround plugin with the Node installer 'Latest' selected. With that working, I know for sure that the problem is limited to the OSX slave.

          Show
          adamdille Adam Dille added a comment - The master is running on Windows Server 2012 R2. None of the remote slaves have any custom node properties, including the mac. Our newest Windows slave doesn't have Node installed on the system at all, since I was using the NodeJS Plugin as a way to reduce that install requirement. That's the slave that is working fine with the custom built workaround plugin with the Node installer 'Latest' selected. With that working, I know for sure that the problem is limited to the OSX slave.
          Hide
          nfalco Nikolas Falco added a comment - - edited

          In the workaround branch I've integrate most recent master commits that fix regression introduced with pipeline work. So please consider to build again.

          This build was used to reproduce your use case:

          1. install a Jenkins 2.44 on a Windows 10 machine.
          2. in setup page I skip any plugin from install.
          3. install only the following plugins (need by your config):
            • custom NodeJS 7ec6423
            • job-restrictions
            • git-parameter
            • throttle-concurrents
            • shelve-project-plugin
            • cobertura
            • bitbucket-build-status-notifier
            • envinject
          4. configure a macviabuild01 node started by JNPL (Java Web Start)
          5. create ShopAtHome Extension Core freestyle job
          6. copy your config.xml in on top the existing
          7. restart Jenkins
          8. setup NodeJS configuration tool like in your screenshot
          9. edit job configuration to remove:
            • any SCM
            • comment gulp command
            • remove any job parameter

          Follow the output:

          Started by user anonymous
          [EnvInject] - Loading node environment variables.
          Building remotely on viamacbuild01 in workspace /Users/me/jenkinsslave/workspace/ShopAtHome Extension Core
          Unpacking https://nodejs.org/dist/v5.9.1/node-v5.9.1-darwin-x64.tar.gz to /Users/nikolasfalco/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1 on viamacbuild01
          /Users/me/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1/bin/npm install -g gulp jshint karma-phantomjs-launcher
          npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
          ...CUTTED...
          npm WARN karma-phantomjs-launcher@1.0.2 requires a peer of karma@>=0.9 but none was installed.
          [ShopAtHome Extension Core] $ /bin/sh -xe /var/folders/jq/2l9t7bw1103_jjyv9rzk7kcr0000gn/T/hudson134818345472423975.sh
          + echo /Users/me/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
          /Users/me/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
          + npm install
          npm WARN enoent ENOENT: no such file or directory, open '/Users/me/jenkinsslave/workspace/ShopAtHome Extension Core/package.json'
          npm WARN ShopAtHome Extension Core No description
          npm WARN ShopAtHome Extension Core No repository field.
          npm WARN ShopAtHome Extension Core No README data
          npm WARN ShopAtHome Extension Core No license field.
          

          The path in echo command was right and npm command was found but fail due no package.json in workspace (miss source code).

          In the future I will merge to this branch only released commits to avoid work in progress issues

          Show
          nfalco Nikolas Falco added a comment - - edited In the workaround branch I've integrate most recent master commits that fix regression introduced with pipeline work. So please consider to build again. This build was used to reproduce your use case: install a Jenkins 2.44 on a Windows 10 machine. in setup page I skip any plugin from install. install only the following plugins (need by your config): custom NodeJS 7ec6423 job-restrictions git-parameter throttle-concurrents shelve-project-plugin cobertura bitbucket-build-status-notifier envinject configure a macviabuild01 node started by JNPL (Java Web Start) create ShopAtHome Extension Core freestyle job copy your config.xml in on top the existing restart Jenkins setup NodeJS configuration tool like in your screenshot edit job configuration to remove: any SCM comment gulp command remove any job parameter Follow the output: Started by user anonymous [EnvInject] - Loading node environment variables. Building remotely on viamacbuild01 in workspace /Users/me/jenkinsslave/workspace/ShopAtHome Extension Core Unpacking https://nodejs.org/dist/v5.9.1/node-v5.9.1-darwin-x64.tar.gz to /Users/nikolasfalco/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1 on viamacbuild01 /Users/me/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1/bin/npm install -g gulp jshint karma-phantomjs-launcher npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue ...CUTTED... npm WARN karma-phantomjs-launcher@1.0.2 requires a peer of karma@>=0.9 but none was installed. [ShopAtHome Extension Core] $ /bin/sh -xe /var/folders/jq/2l9t7bw1103_jjyv9rzk7kcr0000gn/T/hudson134818345472423975.sh + echo /Users/me/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin /Users/me/jenkinsslave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/5.9.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin + npm install npm WARN enoent ENOENT: no such file or directory, open '/Users/me/jenkinsslave/workspace/ShopAtHome Extension Core/package.json' npm WARN ShopAtHome Extension Core No description npm WARN ShopAtHome Extension Core No repository field. npm WARN ShopAtHome Extension Core No README data npm WARN ShopAtHome Extension Core No license field. The path in echo command was right and npm command was found but fail due no package.json in workspace (miss source code). In the future I will merge to this branch only released commits to avoid work in progress issues
          Hide
          adamdille Adam Dille added a comment - - edited

          Success! 7ec6423 is working on both Windows and OSX slaves without Node installed locally. Thanks for tracking down the problem, Nikolas Falco. Hopefully EnvInject fixes their issues sometime soon and I can get us back onto the public master branch plugins.

          Show
          adamdille Adam Dille added a comment - - edited Success! 7ec6423 is working on both Windows and OSX slaves without Node installed locally. Thanks for tracking down the problem, Nikolas Falco . Hopefully EnvInject fixes their issues sometime soon and I can get us back onto the public master branch plugins.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            afischer Alexander Fischer
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: