Unitech / Unitech/pm2

pm2 restart not working with npm script

Open
#4,083 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Inspecting
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

I start my app with the following command:

pm2 start npm --name “my-site" -i 0 -- run runGlobalProduction

But I'm finding that its intermittently crashing and not re-starting, even though when I ls the . processes, "my-site" shows as online. I have to reload my-site to get it to work.

Checking the logs, I can see this error but its not very informative:

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
0|my-sit | ERR! code ELIFECYCLE
0|my-sit | npm ERR! errno 1
0|my-sit | npm ERR! my-website@3.2.4 runGlobalProduction: export PORT=8080 CONFIG_PATH=config/web/global-production.config.json&&npm run apiServer
0|lmy-sit | npm ERR! Exit status 1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported pm2 start npm --name ... -i 0 -- run runGlobalProduction command and inspect the PM2 process status alongside the npm error output. The issue is resolved when an intermittent npm-script crash causes the managed process to restart and its reported status accurately reflects availability.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.