Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.61k stars 2.62k forks source link

PM2 cannot start my Angular app while ng serve (run) do #5388

Open mamiapatrick opened 2 years ago

mamiapatrick commented 2 years ago

What's going wrong?

Hello, I just try to deploy my angular app V13 with the tool pm2. everything was going well until i tried to setup my certificate and deploy ssl for https.

How could we reproduce this issue?

I setup the package.json ng run <myproject>:serve-zip --configuration production --host 0.0.0.0 --disable-host-check --ssl and the angular.json

"serve-zip": { "builder": "@angular-builders/custom-webpack:dev-server", "options": { "browserTarget": "e-learning:build-zip:production", "ssl": true, "sslKey": "./ssl/server.key", "sslCert": "./ssl/server.crt", "publicHost":":4200" }, "configurations": { "production": { "browserTarget": ":build-zip:production" }, "development": { "browserTarget": ":build-zip:development" } }, "defaultConfiguration": "production" },

Supporting information

When i launch with the command ng run directly everything is ok but when i use pm2 start i got this error

5|pl-front |             const address = devServer.server.address();
5|pl-front |                                              ^
5|pl-front | TypeError: Cannot read properties of undefined (reading 'address')```

<!--
Please run the following command (available on PM2 >= 2.6)
-->

$ pm2 report

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Jun 23 2022 14:33:17 GMT+0100 (West Africa Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.1.2
node version         : 16.15.0
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 14545min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.1.2
node version         : 16.15.0
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
cpus nb              : 4
freemem              : 6145499136
totalmem             : 8348454912
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬──────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name                 │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼──────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 2   │ xxxxxx-git           │ default     │ N/A     │ fork    │ 2878     │ 10D    │ 0    │ online    │ 0.3%     │ 63.4mb   │ root     │ disabled │
│ 1   │ xxxxx1-git           │ default     │ N/A     │ fork    │ 255836   │ 7D     │ 1    │ online    │ 0.2%     │ 61.0mb   │ root     │ disabled │
│ 9   │ xxxxx2-git           │ default     │ N/A     │ fork    │ 1004068  │ 6s     │ 510  │ online    │ 0%       │ 61.9mb   │ root     │ disabled │
└─────┴──────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2        | 2022-06-23T14:32:32: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:32:32: PM2 log: App [pl-frontend-git:9] online
PM2        | 2022-06-23T14:32:38: PM2 log: App [pl-frontend-git:9] exited with code [1] via signal [SIGINT]
PM2        | 2022-06-23T14:32:38: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:32:38: PM2 log: App [pl-frontend-git:9] online
PM2        | 2022-06-23T14:32:45: PM2 log: App [pl-frontend-git:9] exited with code [1] via signal [SIGINT]
PM2        | 2022-06-23T14:32:45: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:32:45: PM2 log: App [pl-frontend-git:9] online
PM2        | 2022-06-23T14:32:51: PM2 log: App [pl-frontend-git:9] exited with code [1] via signal [SIGINT]
PM2        | 2022-06-23T14:32:51: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:32:51: PM2 log: App [pl-frontend-git:9] online
PM2        | 2022-06-23T14:32:57: PM2 log: App [pl-frontend-git:9] exited with code [1] via signal [SIGINT]
PM2        | 2022-06-23T14:32:57: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:32:57: PM2 log: App [pl-frontend-git:9] online
PM2        | 2022-06-23T14:33:04: PM2 log: App [pl-frontend-git:9] exited with code [1] via signal [SIGINT]
PM2        | 2022-06-23T14:33:04: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:33:04: PM2 log: App [pl-frontend-git:9] online
PM2        | 2022-06-23T14:33:11: PM2 log: App [pl-frontend-git:9] exited with code [1] via signal [SIGINT]
PM2        | 2022-06-23T14:33:11: PM2 log: App [pl-frontend-git:9] starting in -fork mode-
PM2        | 2022-06-23T14:33:11: PM2 log: App [pl-frontend-git:9] online
mamiapatrick commented 2 years ago

Any help??