Unitech / pm2

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

:: Created by npm, please don't edit manually. #5571

Open it4sa opened 1 year ago

it4sa commented 1 year ago

What's going wrong?

I'm following this details especially the Start and configure PM2 with a config.js file part but getting this error, anyone ran into this before?

C:\Users\<user>\AppData\Roaming\nvm\v16.15.0\NPM.CMD:1
:: Created by npm, please don't edit manually.
^

SyntaxError: Unexpected token ':'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1033:15)
    at Module._compile (node:internal/modules/cjs/loader:1069:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Object.<anonymous> (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:33:23)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)

How could we reproduce this issue?

Please follow this link to reproduce the error.

Followed this post and also posted below but not reply as yet.

Supporting information

All the information is supplied below.

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Mar 16 2023 23:39:51 GMT+0200 (South Africa Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.2.2
node version         : 16.15.0
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0                : node
user                 : undefined
uid                  : N/A
gid                  : N/A
uptime               : 96min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.2.2
node version         : 16.15.0
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0                : C:\Program Files\nodejs\node.exe
user                 : <user>
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : win32
type                 : Windows_NT
cpus                 : Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
cpus nb              : 4
freemem              : 12363161600
totalmem             : 17178693632
home                 : C:\Users\<user>
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name      │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼───────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ server    │ default     │ 0.1.0   │ fork    │ 268824   │ 89m    │ 0    │ online    │ 0%       │ 136.8mb  │ mon… │ disabled │
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\ProgramData\pm2\home\pm2.log last 20 lines:
PM2        |     at God.deleteProcessId (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\God\ActionMethods.js:366:9)
PM2        |     at Server.onmessage (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon-rpc\lib\server.js:104:6)
PM2        |     at RepSocket.emit (node:events:527:28)
PM2        |     at RepSocket.emit (node:domain:475:12)
PM2        |     at Parser.<anonymous> (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\rep.js:51:15)
PM2        |     at Parser.emit (node:events:527:28)
PM2        |     at Parser.emit (node:domain:537:15)
PM2        |     at Parser._write (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\node_modules\amp\lib\stream.js:91:16)
PM2        |     at Object.God.logAndGenerateError (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\God\Methods.js:34:15)
PM2        |     at C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\God\ActionMethods.js:367:30
PM2        |     at Object.God.stopProcessId (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\God\ActionMethods.js:289:14)
PM2        |     at God.deleteProcessId (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\lib\God\ActionMethods.js:366:9)
PM2        |     at Server.onmessage (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon-rpc\lib\server.js:104:6)
PM2        |     at RepSocket.emit (node:events:527:28)
PM2        |     at RepSocket.emit (node:domain:475:12)
PM2        |     at Parser.<anonymous> (C:\Users\<user>\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\rep.js:51:15)
PM2        |     at Parser.emit (node:events:527:28)
PM2        |     at Parser.emit (node:domain:537:15)
PM2        | 2023-03-16T23:30:16: PM2 log: Stopping app:app id:3
PM2        | 2023-03-16T23:30:16: PM2 error: app=app id=3 does not have a pid
it4sa commented 1 year ago

@Unitech may I ask you for some details on this issue. Thanks!

it4sa commented 1 year ago

@keymetrics can you please help on this? Thanks.

it4sa commented 1 year ago

@nitinmukesh did you ever resolve your issue in #2808? I ran into the same issue and struggling to get it resolved. Thanks.

it4sa commented 1 year ago

Thanks @laminebakelli for your comment on this issue.

I will follow your suggestions but still not working, got this error now : pm2_new_error

May I ask what is the config in your ecosystem.config.js file?

mistryaksh commented 8 months ago

Did anyone resolve this issue, faced same issue with node project

hassaan-AK commented 8 months ago

I am also having the same issue, I was trying to run a simple express app

command: pm2 start npm --name "backend" -- run dev

Error:

PM2        | 2024-01-31T12:32:54: PM2 log: Script C:\PROGRAM FILES\NODEJS\NPM.CMD had too many unstable restarts (16). Stopped. "errored"

C:\Users\SCS\.pm2\logs\backend-app-out.log last 15 lines:
C:\Users\SCS\.pm2\logs\backend-app-error.log last 15 lines:
0|backend- | C:\PROGRAM FILES\NODEJS\NPM.CMD:1
0|backend- | :: Created by npm, please don't edit manually.
0|backend- | ^
0|backend- |
0|backend- | SyntaxError: Unexpected token ':'
0|backend- |     at internalCompileFunction (node:internal/vm:77:18)
0|backend- |     at wrapSafe (node:internal/modules/cjs/loader:1288:20)
0|backend- |     at Module._compile (node:internal/modules/cjs/loader:1340:27)
0|backend- |     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
0|backend- |     at Module.load (node:internal/modules/cjs/loader:1207:32)
0|backend- |     at Module._load (node:internal/modules/cjs/loader:1023:12)
0|backend- |     at Object.<anonymous> (C:\Users\SCS\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:33:23)
0|backend- |     at Module._compile (node:internal/modules/cjs/loader:1376:14)
0|backend- |     at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
0|backend- |     at Module.load (node:internal/modules/cjs/loader:1207:32)
hassaan-AK commented 8 months ago

I got it working but it opens up a terminal try it like this instead of npm use its path. pm2 start "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" --name "MultilingualSystem" -- run dev

doppelgunner commented 3 weeks ago

It seems like this is happening because of nvm

\nvm\v20.15.0\NPM.CMD:1
:: Created by npm, please don't edit manually.