Powershell foreverjs stop all not working

Hello, I am having an issue with the deployment process for a Node.js application to a Windows machine using Octopus v2019.12.1 LTS with foreverjs. The deployment process did work correctly in the past so I’m thinking an update to Octopus could have introduced some regression issues.

The following is the deployment process for the script:

    $installDirectory = $OctopusParameters['Octopus.Action.Package.CustomInstallationDirectory']
    Write-Output 'Current installation directory is : ' $installDirectory

    cd $installDirectory
    npm install


    Write-Host "Stopping #{Octopus.Environment.Name} running forever processes..."
    $node = "node.exe"
    Start-Process $node ".\node_modules\forever\bin\forever stopall"

    Write-Host "Starting #{Octopus.Environment.Name} as new forever process..."
    $arguments = ".\node_modules\forever\bin\forever start .\forever\#{Octopus.Environment.Name}.json"

    Start-Process $node $arguments
    Write-Host "Forever Process Started: #{Octopus.Environment.Name}"

The old existing node instances started by forever should be removed and new instances should be started, but the old instances are not removed.

I have been able to distinguish this even further by having existing forever processes running on the VM started by the script and then change the script to only stop all running instances (effectively removing the start portion of the script) and the forever instances remain intact.

Running the procedure locally on the VM works - but not through the deployment process.

Looking for any guidance you might have


Welcome to the Octopus Forums.

Thanks for reaching out. From which version of Octopus Server did you upgrade from where it was working?

Can you please privately message me a full task log from a successful deployment of this as well as an unsuccessful one?


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.