How do you run lite-server as a Windows service?

684 views Asked by At

I am trying to set up lite-server as a Windows service so that it starts automatically when the machine starts. I am trying to do this via NSSM.

I install as follows:

nssm install <servicename> lite-server

Then, since I see it complaining in the event viewer about the directory it's running from, I add this:

nssm set <servicename> AppDirectory <serviceDirectory>

If I run lite-server directly from the command line it works.

However, if I start the Windows service installed as above, it fails, and in the event viewer I get:

Failed to start service . Program lite-server couldn't be launched. CreateProcess() failed: The system cannot find the file specified.

I have tried:

  1. Adding the path to %APPDATA%\npm to the system path to make sure lite-server can be found.
  2. Installing the service under my own username.

It didn't work. What do I need to do to run lite-server as a Windows service?

1

There are 1 answers

0
Mekicim On

please try with same config

path: C:\Users\{username}\AppData\Roaming\npm\lite-server.cmd

startup directory : bs-config.json config file path

screenshot like this