Skip to content

Instantly share code, notes, and snippets.

@AaronNGray
Created October 6, 2019 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AaronNGray/128c1587b33dba0a81e8647947f3a3d4 to your computer and use it in GitHub Desktop.
Save AaronNGray/128c1587b33dba0a81e8647947f3a3d4 to your computer and use it in GitHub Desktop.

How to install npm_lazy as a Windows Service from the command line.

Download NSSM and install it in a directory on the path.

Install npm_lazy and create a configuration file :-

npm install -g npm_lazy
npm_lazy --init > "%userprofile%/npm_lazy.config.js"

To create a Windows Service for npm_lazy :-

nssm install npm_lazy "%ProgramFiles%\nodejs\node.exe"
nssm set npm_lazy AppDirectory "%userprofile%\.npm_lazy"
nssm set npm_lazy AppParameters "%userprofile%\AppData\Roaming\npm\node_modules\npm_lazy\bin\npm_lazy --config %userprofile%\npm_lazy.config.js"

To point NPM at npm_lazy :-

npm config set registry http://localhost:8080/

To start the Service :-

nssm start npm_lazy

To restart the service :-

nssm restart npm_lazy

To stop the service :-

nssm stop npm_lazy

To remove the service :-

nssm remove npm_lazy confirm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment