Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js can be run as a Windows Service using FireDaemon Pro, which allows you to have the script start automatically at boot prior to login, start multiple instances of the script and more. This HOWTO will show you how to set it up. You can also use FireDaemon Fusion to manage FireDaemon and other Windows services via a web browser.

Node.js Setup Under FireDaemon Pro

Download the latest Node.js Installer from here. By default the application installs to C:\Program Files\nodejs. Note that for the purposes of this HOWTO, we will be loading scripts from the directory C:\Node.js Scripts.

Download and install FireDaemon Pro into the directory of your choice, typically C:\Program Files\FireDaemon.

Next start the FireDaemon GUI from the desktop shortcut. Click on the "Create a new service definition" button in the toolbar (or type Ctrl+N) and enter the information into the fields as you see below. Adjust the paths to suit your installation. Note the required parameters.

  • Executable: The path to your node.exe file. For the purposes of this HOWTO, the path is C:\Program Files\nodejs\node.exe.
  • Working Directory: The directory containing your node.exe file. For the purposes of this HOWTO, the path is C:\Program Files\nodejs.
  • Parameters: "C:\Node.js Scripts\example.js" - The path and filename of the Node.js script you want to run. Make sure to enclose the entire path in quotes or else the Node.js wont load it.

Now click on the Settings tab. If you DON'T want to see the Node.js script running, uncheck the Interact with Desktop check box & select "Hidden" from the "Show Window" dropdown. You must set the job type to "Global" so that child processes are terminated properly when the service is stopped or restarted. You can optionally run the Node.js as the user you installed it as. You can change the Process Priority to allocate more CPU time to your Node.js script or specify which CPU or core your Node.js script will run on (in the case of multi-processor, hyperthreaded or multi-core CPUs).

Now click on the Lifecycle tab. Uncheck Graceful Shutdown as it can slow the shutdown of the Node.js. Make sure "Console Application" is checked.

If for troubleshooting purposes you want to see what Node.js is displaying in its window, you can redirect its output to text to a file. Choose a path to a .log file. Note that this step is optional.

Now click on the OK button to install and start your Node.js script!