How to keep Nodejs running

I have a nodejs running on one of my domains. I run npm start to start the server. Everything works just fine. However, when I close the terminal is kills the process and my website doesnt work anymore. All the answers on the web say to use the command forever but forever is not installed on the VPS. To install forever I need sudo access and we are not given sudo access on VPS.

How do I run my node server so it stays running?

1 Like

See if this can help you:

I never installed Node.JS so I can’t say if it can be done this way, but I have some permanent processes on my VPS (memcache and two python scripts). In the good old IRC days I also used to run eggdrop that way (not here, obviously).

Agreed that the post referenced is a good suggestion, just run nohup nom start & and it will keep running when you close your terminal.

Hi Gary, have you already tried enabling Passenger on your domain as described on ? That should do the trick. Let us know if you have other issues with it, happy to help you troubleshoot.

Neither of these work. I have passenger enabled and I tried the nohup nom start & suggestion. It ran my server for about a day and then the process was killed.

I am seriously confused why Dreamhost just doesn’t have forever command installed on the VPS.

I did the things that were suggested but the node app still does not continue running when I close the terminal.

I am currently experiencing this exact problem.

nohup is not working to keep my node.js server running, and I have enabled Passenger. Seems like maybe there needs to be a passenger command to make the node server run persistently.

d’oh! Found the solution to my problem here:

I was assuming that Forever required sudo to be installed (because of the -g global flag). I was wrong.

Hi there. I am new to this platform. Interesting thread, thanks for the information :hugs: