npm Review does not work locally or in hosting

Asked

Viewed 74 times

0

I have a Node application that I run with the command:

node server.js

But when I close the terminal where the command was executed, the application closes.

Researching found package npm Forever. I made the installation globally according to guidelines on the page, and running

forever server.js

The same thing happens. I close the window and the application closes. Does anyone know any alternative to running tasks from the background? Is it an incompatibility with the current version of Node?

  • Right... well.. I wanted something that would work like in the example of this video. https://youtu.be/P4mT5Tbx_KE In this video the command 'hohup npde server.js' And when it closes the temrinal window the server keeps running.

  • I believe your main question has been answered by Joao. Regarding another service manager (for production), you can use the PM2.

1 answer

1

Try to use forever start server.js

According to the website of the package, missed the word start at your command, try to test and see if it is right

Website of the Forever Package

  • Oh yes.. I wrote it wrong. But even with the start it doesn’t work... neither Forever nor the youtube example with nohup...

  • Does it accuse an error? If there is any way you can send some print or line of code, it is returning when you type this command

  • There is no error. It is as if I am not using Forever. works as if I am simply running with 'Node server.js'. When I close the terminal window... the app closes.

  • Try using the Forever command pointing to the directory. After this try using the "Forever list" command to list all the running processes

Browser other questions tagged

You are not signed in. Login or sign up in order to post.