coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.79k stars 358 forks source link

How to install an executable (.exe) as a service instead of .js script using node-windows? #210

Closed apurvshah closed 6 years ago

apurvshah commented 6 years ago

Hi,

I am using 'pkg' to package my node.js project into an executable and wanted it be run as a windows service and for that I am trying to use node-windows.

When I use my server.js file to be installed as a windows service, it successfully installed as a service and run. But in that case I have to ship my entire code, which I don't want.

Can I install executable (.exe) as a service using node-windows (I tried, but did not get success)? This executable is created using 'pkg' .

coreybutler commented 6 years ago

No, you cannot package anything with node-windows. You'd be better off creating an installer to leverage your pkg build. You may want to take a look at the underlying library node-windows uses (winsw).

Node-windows is more like a process manager (i.e. like PM2, but using the native OS). Pkg is more of a build tool.