yinxin630 / fiora

An interesting open source chat application. Developed with node.js, mongoDB, socket.io and react
https://fiora.suisuijiang.com
MIT License
6.57k stars 1.31k forks source link

pm2 运行后,过几秒钟 pm2 list 就显示 errored 的 status #512

Closed anyshift closed 1 year ago

anyshift commented 2 years ago

列出 pm2 的日志:

[root@growing-poll-1 ~]# pm2 logs
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/root/.pm2/pm2.log last 15 lines:
PM2        | 2022-08-28T18:39:08: PM2 log: App [fiora:0] online
PM2        | 2022-08-28T18:39:08: PM2 log: App [fiora:0] exited with code [1] via signal [SIGINT]
PM2        | 2022-08-28T18:39:08: PM2 log: App [fiora:0] starting in -fork mode-
PM2        | 2022-08-28T18:39:08: PM2 log: App [fiora:0] online
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] exited with code [1] via signal [SIGINT]
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] starting in -fork mode-
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] online
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] exited with code [1] via signal [SIGINT]
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] starting in -fork mode-
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] online
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] exited with code [1] via signal [SIGINT]
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] starting in -fork mode-
PM2        | 2022-08-28T18:39:09: PM2 log: App [fiora:0] online
PM2        | 2022-08-28T18:39:10: PM2 log: App [fiora:0] exited with code [1] via signal [SIGINT]
PM2        | 2022-08-28T18:39:10: PM2 log: Script /usr/bin/yarn had too many unstable restarts (16). Stopped. "errored"

/root/.pm2/logs/fiora-out.log last 15 lines:
/root/.pm2/logs/fiora-error.log last 15 lines:
0|fiora    | /usr/share/yarn/bin/yarn:2
0|fiora    | argv0=$(echo "$0" | sed -e 's,\\,/,g')
0|fiora    |         ^^^^
0|fiora    | 
0|fiora    | SyntaxError: missing ) after argument list
0|fiora    |     at wrapSafe (internal/modules/cjs/loader.js:1001:16)
0|fiora    |     at Module._compile (internal/modules/cjs/loader.js:1049:27)
0|fiora    |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
0|fiora    |     at Module.load (internal/modules/cjs/loader.js:950:32)
0|fiora    |     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
0|fiora    |     at Object.<anonymous> (/root/node-v14.20.0-linux-x64/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
0|fiora    |     at Module._compile (internal/modules/cjs/loader.js:1085:14)
0|fiora    |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
0|fiora    |     at Module.load (internal/modules/cjs/loader.js:950:32)
0|fiora    |     at Function.Module._load (internal/modules/cjs/loader.js:790:12)

pm2 list 结果:

[root@growing-poll-1 ~]# pm2 list
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ fiora              │ fork     │ 15   │ errored   │ 0%       │ 0b       │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

node server.js 结果:

[root@growing-poll-1 ~]# node server.js
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module '/root/server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
[root@growing-poll-1 ~]#