|
|
|
# Install PM2
|
|
|
|
|
|
|
|
## Copy and paste
|
|
|
|
```
|
|
|
|
> mkdir c:\etc\.pm2
|
|
|
|
> setx PM2_HOME c:\etc\.pm2 /m
|
|
|
|
> npm install pm2 -g
|
|
|
|
> pm2 install pm2-logrotate
|
|
|
|
> npm install -g pm2-windows-service
|
|
|
|
> npm install -g npm-check-updates
|
|
|
|
> cd %USERPROFILE%\AppData\Roaming\npm\node_modules\pm2-windows-service
|
|
|
|
> ncu inquirer -u
|
|
|
|
> npm install
|
|
|
|
> pm2-service-install -n PM2
|
|
|
|
```
|
|
|
|
|
|
|
|
## Options when installing pm2-windows-service
|
|
|
|
```
|
|
|
|
> Perform environment setup (recommended)? Yes
|
|
|
|
> Set PM2_HOME? Yes
|
|
|
|
> PM2_HOME value (this path should be accessible to the service user and
|
|
|
|
should not contain any “user-context” variables [e.g. %APPDATA%]): c:\etc\.pm2\
|
|
|
|
> Set PM2_SERVICE_SCRIPTS (the list of start-up scripts for pm2)? No
|
|
|
|
> Set PM2_SERVICE_PM2_DIR (the location of the global pm2 to use with the service)? [recommended] Yes
|
|
|
|
> Specify the directory containing the pm2 version to be used by the
|
|
|
|
service C:\USERS\<USER>\APPDATA\ROAMING\NPM\node_modules\pm2\index.js
|
|
|
|
PM2 service installed and started.
|
|
|
|
```
|
|
|
|
|
|
|
|
## Reference
|
|
|
|
* [PM2 Startup on Windows](https://blog.cloudboost.io/nodejs-pm2-startup-on-windows-db0906328d75)
|
|
|
|
* [PM2 ecosystem example](http://gitlab.web-on.com/snippets/2) |
|
|
|
\ No newline at end of file |