I have gone through so many questions regarding forever module for nodejs APP, but did not find my answer.
Forever
module is working fine on a Linux box but now I am putting my APP on Windows 7 and trying to run it with forever. First i installed forever module as
npm install forever -g
after that I ran my app as
forever start app.js
it's running fine by saying file app.js is running with forever and I am accessing my app successfully.
When I execute a command forever stop app.js
I get the error
no forever file is running
Please suggest me if anyone has used forever on windows that how can I stop my application on Windows.
nodejs process is running an executable file node.exe in windows. One way is stop single node process in Windows Find all process ids for a given port listening. use the /f option for killing a single process forcefully. This stops and kill all node process in windows.
Try taskkill /IM node.exe . It will kill all processes named node.exe . I had to use taskkill /F /IM node.exe to make it work, thanks!
use forever list
then forever stop with the id, e.g. forever stop 0
Here is a sample output
user@some-server]$ forever list info: Forever processes running data: uid command script forever pid id logfile uptime data: [0] 9Xzw ng serve --host 0.0.0.0 --port 4009 13164 29579 /home/ec2-user/.forever/9Xzw.log 7:1:20:50.412 data: [1] wOj1 npm run-script app-start-dev 29500 24978 /home/ec2-user/.forever/wOj1.log 0:0:5:3.433
Here 0
is like an index which is in the first column of the output. If there are two processes running, we can use indexes like 0
or 1
to stop the first or the second process.
forever stop 0
OR forever stop 1
I had this same issue and found that it was because I was running forever start with sudo (on Linux) so that I could run a production site on port 80. This did the trick:
sudo forever list
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With