Bamboo remote build agent cannot find powershell.exe after installing nodejs

I just installed nodejs on one of my build servers (Win Server 2008 R2), which hosts a remote Bamboo agent. After completing the installation and performing a reboot, I was stuck in the following situation:

The Bamboo Remote Build Agent runs as a Windows service with user MyDomain \ MyUser. When the build is executed with the built-in powershell task with an error (from the build agent log):

com.atlassian.utils.process.ProcessNotStartedException: powershell could not be started ... java.io.IOException: Cannot run program "powershell" ... java.io.IOException: CreateProcess error=2, The system cannot find the file specified 

Loggin on the server as MyDomain \ MyUser, I checked that powershell is in the path:

 where powershell C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 

I tried to restart the service and restart the computer several times. Bad luck. The only thing that works is that I execute my scripts as a bat file with an absolute powershell path - but I don't want this.

I was looking for solutions on this, but even if it looks like this: Hudson cannot find powershell after upgrading to powershell 3 - the proposed solutions do not work.

What am I missing here?

+10
source share
1 answer

If you are installing nodejs by default, you will see that adds nodejs and npm to the path. Sometimes I saw the installer add a user variable named PATH - perhaps the Bamboo agent decides to read the user path without merging it with the system path. I think it's worth a try.

+13
source

Source: https://habr.com/ru/post/987018/


All Articles