2021-07-11 08:42:56 -05:00
---
id: windows
2022-12-25 12:48:18 -05:00
title: 'Installing As a Windows Service'
2021-07-11 08:42:56 -05:00
---
Loosely based upon the instructions found [here ](http://asysadmin.tumblr.com/post/32941224574/running-nginx-on-windows-as-a-service ). I crafted the following and it provided me with a fully working verdaccio service installation:
1. Create a directory for verdaccio
2022-12-25 12:48:18 -05:00
- mkdir `c:\verdaccio`
- cd `c:\verdaccio`
2021-07-11 08:42:56 -05:00
2. Install verdaccio locally (I ran into npm issues with global installs)
2022-12-25 12:48:18 -05:00
- npm install verdaccio
2021-07-11 08:42:56 -05:00
3. Create your `config.yaml` file in this location `(c:\verdaccio\config.yaml)`
4. Windows Service Setup
2021-07-27 14:52:49 -05:00
## Using NSSM {#using-nssm}
2021-07-11 08:42:56 -05:00
ALTERNATIVE METHOD: (WinSW package was missing when I tried to download it)
2022-12-25 12:48:18 -05:00
- Download [NSSM ](https://www.nssm.cc/download/ ) and extract
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
- Add the path that contains nssm.exe to the PATH
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
- Open an administrative command
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
- Run nssm install verdaccio At a minimum you must fill in the Application tab Path,
Startup directory and Arguments fields. Assuming an install with node in the system path and a
location of c:\verdaccio the below values will work:
_ Path: `node`
_ Startup directory: `c:\verdaccio` \* Arguments: `c:\verdaccio\node_modules\verdaccio\build\lib\cli.js -c c:\verdaccio\config.yaml`
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
You can adjust other service settings under other tabs as desired. When you are done, click Install service button
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
- Start the service sc start verdaccio
2021-07-11 08:42:56 -05:00
2021-07-27 14:52:49 -05:00
## Using WinSW {#using-winsw}
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
- As of 2015-10-27, WinSW is no longer available at the below location. Please follow the Using NSSM instructions above.
- Download [WinSW ](http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/ )
- Place the executable (e.g. `winsw-1.9-bin.exe` ) into this folder (`c:\verdaccio`) and rename it to `verdaccio-winsw.exe`
- Create a configuration file in `c:\verdaccio` , named `verdaccio-winsw.xml`
with the following configuration `xml verdaccio verdaccio verdaccio node c:\verdaccio\node_modules\verdaccio\src\lib\cli.js -c c:\verdaccio\config.yaml roll c:\verdaccio\ ` .
- Install your service
- `cd c:\verdaccio`
- `verdaccio-winsw.exe install`
- Start your service
- `verdaccio-winsw.exe start`
2021-07-11 08:42:56 -05:00
Some of the above config is more verbose than I had expected, it appears as though 'workingdirectory'
is ignored, but other than that, this works for me and allows my verdaccio instance to
persist between restarts of the server, and also restart itself should there be any crashes of the verdaccio process.
2021-07-27 14:52:49 -05:00
## Repositories {#repositories}
2021-07-11 08:42:56 -05:00
2022-12-25 12:48:18 -05:00
- [verdaccio-deamon-windows ](https://github.com/davidenke/verdaccio-deamon-windows )