Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to package nodejs and install a windows service with NSIS?

I am currently using os-service to create a Windows service that needs to be packaged with my Electron application. Currently, everything is installed with NSIS, but I'm not quite sure how to install and run an os-service script during installation. Likewise for uninstallation.

Anyone with experience with this? The service is installed using node to run the script.

like image 532
ajbs Avatar asked Dec 12 '25 19:12

ajbs


1 Answers

When you install Node.js runtime on target computer it should contain everything necessary to run apps properly.

Node.js also installs npm so it should be possible to execute npm install os-service from your NSIS installer somehow like this:

  1. Install Node.js runtime from your installer (it is .msi package so use ExecWait command to run it from some Temp folder)
  2. Get the npm path. Here I suppose npm on Windows is something like npm.exe located in bin or similar directory of Node.js and the path can be retrieved from Registry.
  3. Run the npm: npm install os-service from your installer - again use ExecWait or related. You will have to use absolute paths and so on.

I have no experience with web apps, there more be some dependencies and so on so you need to do a little more investigation.

like image 106
Slappy Avatar answered Dec 15 '25 09:12

Slappy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!