How to keep Nodejs running

software development

#1

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?


#2

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).


#3

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


#4

Hi Gary, have you already tried enabling Passenger on your domain as described on https://help.dreamhost.com/hc/en-us/articles/216635318-How-to-enable-Node-js ? That should do the trick. Let us know if you have other issues with it, happy to help you troubleshoot.


#5

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.


#6

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