Unitech / Unitech/pm2

pm2-dev doesn't detect file changes, pm2-runtime --watch does

Open
#4,915 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What's going wrong?

  1. Using yarn pm2-dev server.js usually doesn't pick up file changes in server.js. Once in a while it works, but usually it doesn't.
  2. yarn pm2-runtime start server.js --watch always picks up file changes, 100% reliably.

How could we reproduce this issue?

Create an empty server.js and put console.log(1) into it. Change 1 -> 2.

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Wed Nov 11 2020 19:18:22 GMT+0100 (Central European Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 4.5.0
node version         : 10.20.1
node path            : /Users/user/Documents/dev/maphub/web/socketio/node_modules/.bin/pm2
argv                 : /Users/user/.nvm/versions/node/v10.20.1/bin/node,/Users/user/Documents/dev/maphub/web/socketio/node_modules/pm2/lib/Daemon.js
argv0                : /Users/user/.nvm/versions/node/v10.20.1/bin/node
user                 : user
uid                  : 501
gid                  : 20
uptime               : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 4.5.0
node version         : 10.20.1
node path            : /Users/user/Documents/dev/maphub/web/socketio/node_modules/.bin/pm2
argv                 : /Users/user/.nvm/versions/node/v10.20.1/bin/node,/Users/user/Documents/dev/maphub/web/socketio/node_modules/.bin/pm2,report
argv0                : /Users/user/.nvm/versions/node/v10.20.1/bin/node
user                 : user
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
cpus nb              : 8
freemem              : 40710144
totalmem             : 8589934592
home                 : /Users/user
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/user/.pm2/pm2.log last 20 lines:
PM2        | 2020-11-06T14:22:38: PM2 log: Stopping app:server id:0
PM2        | 2020-11-06T14:22:38: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
PM2        | 2020-11-06T14:22:39: PM2 log: pid=53355 msg=process killed
PM2        | 2020-11-06T14:22:39: PM2 log: PM2 successfully stopped
PM2        | 2020-11-11T19:18:22: PM2 log: ===============================================================================
PM2        | 2020-11-11T19:18:22: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2020-11-11T19:18:22: PM2 log: Time                 : Wed Nov 11 2020 19:18:22 GMT+0100 (Central European Standard Time)
PM2        | 2020-11-11T19:18:22: PM2 log: PM2 version          : 4.5.0
PM2        | 2020-11-11T19:18:22: PM2 log: Node.js version      : 10.20.1
PM2        | 2020-11-11T19:18:22: PM2 log: Current arch         : x64
PM2        | 2020-11-11T19:18:22: PM2 log: PM2 home             : /Users/user/.pm2
PM2        | 2020-11-11T19:18:22: PM2 log: PM2 PID file         : /Users/user/.pm2/pm2.pid
PM2        | 2020-11-11T19:18:22: PM2 log: RPC socket file      : /Users/user/.pm2/rpc.sock
PM2        | 2020-11-11T19:18:22: PM2 log: BUS socket file      : /Users/user/.pm2/pub.sock
PM2        | 2020-11-11T19:18:22: PM2 log: Application log path : /Users/user/.pm2/logs
PM2        | 2020-11-11T19:18:22: PM2 log: Worker Interval      : 30000
PM2        | 2020-11-11T19:18:22: PM2 log: Process dump file    : /Users/user/.pm2/dump.pm2
PM2        | 2020-11-11T19:18:22: PM2 log: Concurrent actions   : 2
PM2        | 2020-11-11T19:18:22: PM2 log: SIGTERM timeout      : 1600
PM2        | 2020-11-11T19:18:22: PM2 log: ===============================================================================

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

Reproduce the issue with an empty server.js using yarn pm2-dev server.js, then compare it with yarn pm2-runtime start server.js --watch. Trace the file-watching entry points for these commands and verify that changing server.js reliably triggers the same restart behavior in pm2-dev.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.