Toc
  1. First you will need:
  2. 1 step: Set your Node.js application as Windows Service
  3. 2 step: Edit registry
Toc
0 results found
Seven Chen
Node.js Application as a Windows Service (With Registry Fix) - Measuring Programming Progress by Lines of Code Is Like Measuring Aircraft Building Progress by Weight.

npm install In my case, command nssm install MyWebService… was unsuccessful, the problem was that app.js can’t find config.json file.

First you will need:

  1. Node.js application (project) which you want to run as a Windows Service
  2. Node.js
  3. NSSM

1 step: Set your Node.js application as Windows Service

Download nssm.exe and put file into you node.js project folder Put nssm.exe file into you node.js project folder Run Windows Command Processor (cmd.exe) as administrator and go to your node.js project folder Your node.js project folder Run command npm install npm install Run command node src\app.js and allow access through Windows firewall Allow access through Windows firewall Run these two commands nssm.exe install MyWebService “C:\Program Files\nodejs\node.exe” “C:\Service\src\app.js” net start MyWebService net start MyWebService Now we need to fix this error.

2 step: Edit registry

Open registry editor (regedit.exe) and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyWebService\Parameters HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyWebService\Parameters Now we need to change AppDirectory from C:\Program Files\nodejs to C:\Service Change AppDirectory from C:\Program Files\nodejs to C:\Service Restart computer and don’t forget to run Apache, MySQL or any other necessary servers for your project after restart. Node.js Application as a Windows Service

本文作者:Seven Chen
版权声明:本文首发于Seven Chen的博客,转载请注明出处!