16

I am trying to deploy nodejs in a windows environment. As far as I can see nodejs is just a standard application run through the command-line. However running it that way is not very practical in a server environment. Is there a way to run it as a windows service, so you get all the benefits of controlling the execution as you have with other services? I found similar forum entries about this subject, however they are all related to running nodejs in a linux environment, how would you go about doing this in a window environment?

4
  • What's not practical? Commented Sep 16, 2013 at 16:41
  • 1
    It's not practical, since it requires you to constantly be logged into the server in a session with a command line, and if the server is rebooted or nodejs crashes, you need to rerun the command, so you need to constantly monitor it. Commented Sep 16, 2013 at 16:43
  • 3
    possible duplicate of How to install node.js as windows service? Commented Sep 16, 2013 at 16:49
  • 2
    You might want to read this, hanselman.com/blog/… It basically solves all the problems you mentioned. Commented Mar 10, 2014 at 17:01

1 Answer 1

14

Nodejs application is not like mongodb, redis, nginx ... It's not supposed to run as an os service.

As a best practice, people usually use a process management tool like pm2 to run production nodejs applications. You can give it a try by creating a deploy.sh or deploy.bat as an execution file which trigger pm2 command to start or restart the application.

Sign up to request clarification or add additional context in comments.

1 Comment

How about the MongoDB that goes along with the Node.js server ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.