Reputation: 162
I installed pm2 with NPM without the global flag. Then I started the app with "npm start" that declared on package.json
as
"start": "pm2 start index.js"
How can I stop it?
Upvotes: 1
Views: 1842
Reputation: 191
You can access locally-installed pm2
with npx
:
$ npx pm2 list
$ npx pm2 stop 0 # first app will have ID=0
But in general, I would manage it by attaching a name to the app. Let's edit your package.json
:
"start": "pm2 start index.js --name my-app"
"stop": "pm2 stop my-app",
"logs": "pm2 logs my-app"
And then:
$ npm run start
$ npm run logs
$ npm run stop
Upvotes: 1
Reputation: 162
Oh, was easy as installing it globally
npm install pm2 -g
and then kill the process. I thought it will be a "different" thing
Upvotes: 0