The easiest thing to do would be to specify the full path to npm instead of
just “npm”

In other words, change your task to execute:
/usr/local/bin/npm install

On Thu, Jun 3, 2021 at 5:11 AM Sushma Gangaiah <[email protected]>
wrote:

> Dear Marques,
>
> Please advise me on how to change the invoke path for npm in GoCD. Because
> we have around 8 go-agents and all agents are building pipelines excluding
> one agent and npm path remains the same in all agents.
>
> Regards,
> Sushma
>
> On Thu, Jun 3, 2021, 5:24 PM Marques Lee <[email protected]>
> wrote:
>
>> Ok I see your problem now :).
>>
>> Either the path to npm has changed or the PATH for the GoCD agent has
>> changed.
>>
>> npm is located in /use/local/bin
>>
>> But according to the screenshot, /use/local/bin is not part of the PATH.
>>
>> Only /usr/bin:/bin:/usr/sbin:/sbin
>>
>> So, you’ll need to fix that. Then it should work.
>>
>> -Marques
>>
>> On Thu, Jun 3, 2021 at 4:49 AM Sushma Gangaiah <[email protected]>
>> wrote:
>>
>>> Hi Marques,
>>>
>>> Yes, I was executing as same agent user. Also this has been running
>>> since almost a year, but facing issue all of a sudden even though if
>>> there is no change in infrastructure . Which is making us wonder .Please
>>> help
>>> npm path is in place. PFB screenshot.
>>>
>>> pru7@pru7s-Mac-mini one-pulse-app % npm --version
>>>
>>> 6.14.4
>>>
>>> pru7@pru7s-Mac-mini one-pulse-app % java --version
>>>
>>> openjdk 11.0.7 2020-04-14
>>>
>>> OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
>>>
>>> OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
>>>
>>> pru7@pru7s-Mac-mini one-pulse-app % which npm
>>>
>>> /usr/local/bin/npm
>>>
>>> pru7@pru7s-Mac-mini one-pulse-app % cd
>>>
>>> pru7@pru7s-Mac-mini ~ % command -v npm
>>>
>>> /usr/local/bin/npm
>>>
>>> pru7@pru7s-Mac-mini ~ % ls -l $(command -v npm)
>>>
>>> lrwxr-xr-x  1 root  wheel  38 Jun 19  2020 /usr/local/bin/npm ->
>>> ../lib/node_modules/npm/bin/npm-cli.js
>>>
>>> pru7@pru7s-Mac-mini ~ %
>>>
>>>
>>> Regards,
>>>
>>> Sushma
>>>
>>>
>>> On Thu, Jun 3, 2021 at 5:01 PM Marques Lee <[email protected]>
>>> wrote:
>>>
>>>> Were you execing npm as the same agent user?
>>>>
>>>> Probably be good to find the path the npm and show its permissions bits
>>>>
>>>> try:
>>>>
>>>> 1) command -v npm
>>>> 2) then: ls -l $(command -v npm)
>>>>
>>>> That should tell us the location of the binary and the flags. Just need
>>>> to do a sanity check since I’m not certain where else to start until we
>>>> verify these. The screenshot reported the value of the PATH variable, so
>>>> just making sure npm is under that. When you execute manually, your PATH
>>>> may be different from when invoked by gocd.
>>>>
>>>> On Thu, Jun 3, 2021 at 4:24 AM Sushma Gangaiah <
>>>> [email protected]> wrote:
>>>>
>>>>> Dear Marques,
>>>>>
>>>>> 1.Yes, I am able to run npm install command manually in go-agent.
>>>>>
>>>>> 2.There is no change in infrastructure
>>>>> 3.Binary path is in place.
>>>>>
>>>>> Which is making me wonder . Please advise.
>>>>>
>>>>> Regards,
>>>>> Sushma
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Jun 3, 2021, 4:47 PM Marques Lee <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I would make sure you can hop on the agent and verify that it works
>>>>>> if you exec npm manually as the same user running the agent service.
>>>>>>
>>>>>> Perhaps your infrastructure changed if nothing else has? Check that
>>>>>> the binary is still in the PATH, etc.
>>>>>>
>>>>>> On Thu, Jun 3, 2021 at 3:58 AM Sushma Gangaiah <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi All,
>>>>>>>
>>>>>>> Hope everyone are doing well.
>>>>>>> I am using GoCD version 19.9.0, since morning our builds are failing
>>>>>>> with below error
>>>>>>>
>>>>>>> [go] Task: npm installtook: 0.46s
>>>>>>> Error happened while attempting to execute 'npm install'.
>>>>>>> Please make sure [npm] can be executed on this agent.
>>>>>>> [Debug Information] Environment variable PATH: 
>>>>>>> /usr/bin:/bin:/usr/sbin:/sbin
>>>>>>> [go] Task status: failed, took: 0.46s
>>>>>>> [go] Current job status: failed
>>>>>>>
>>>>>>>  whereas this task was running completely fine till today morning
>>>>>>>
>>>>>>> this below screenshot shows success of "npm install " command.
>>>>>>> Please advice
>>>>>>>
>>>>>>> [go] Task: npm installtook: 25.161s[go] Task: npm installtook:
>>>>>>> 33.196s[go] Task: npm installtook: 1m 38.1
>>>>>>>
>>>>>>> Please do not say to enclose this in shell script as this task was
>>>>>>> working till today morning
>>>>>>>
>>>>>>> task block
>>>>>>>             - exec:
>>>>>>>                 arguments:
>>>>>>>                 - install
>>>>>>>                 command: npm
>>>>>>>                 working_directory: ./abcd
>>>>>>>                 run_if: passed
>>>>>>> Regards,
>>>>>>> Sushma
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "go-cd" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/go-cd/CAHDZtpROhk9LpbZrzAPyKpeKmmZ9-rhwe7ptQFMdZv3ti69REw%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/go-cd/CAHDZtpROhk9LpbZrzAPyKpeKmmZ9-rhwe7ptQFMdZv3ti69REw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "go-cd" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>>
>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/go-cd/CAPKX9jZfVsS0rCsLkPdboYw2T2uM2-z%3DC6yHMVZaHdUkch1eKQ%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/go-cd/CAPKX9jZfVsS0rCsLkPdboYw2T2uM2-z%3DC6yHMVZaHdUkch1eKQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/CAPKX9jaNFT8yimPQ3-77DX-Rxw0TB83HJx8OJ2tqs8HoJapY1Q%40mail.gmail.com.

Reply via email to