pm2
pm2 copied to clipboard
SyntaError with any node script (like npm) on Node v17.2.0
What's going wrong?
When trying to run any node related script (I have tried npm as well as ts-node), they will completely fail to run, with a Syntax Error
Supporting information
The full error message:
C:\Users\Seth\AppData\Roaming\nvm\v17.2.0\NPM.CMD:1
@ECHO off
^
SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1026:15)
at Module._compile (node:internal/modules/cjs/loader:1061:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Object.<anonymous> (C:\Users\Seth\AppData\Roaming\nvm\v17.2.0\node_modules\pm2\lib\ProcessContainerFork.js:33:23)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
How could we reproduce this issue?
npm install -g pm2
pm2 start npm, or pm2 start npm -- init, or pm2 start npm -- run start or any other command that results in a file from nvm/v17.2.0/*.CMD running.
$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date : Mon Jun 20 2022 00:22:55 GMT-0400 (Eastern Daylight Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.2.0
node version : 17.2.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Seth\AppData\Roaming\nvm\v17.2.0\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 23min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.2.0
node version : 17.2.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Program Files\nodejs\node_modules\pm2\bin\pm2,report
argv0 : C:\Program Files\nodejs\\node.exe
user : Seth
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
cpus nb : 8
freemem : 2183548928
totalmem : 16968302592
home : C:\Users\Seth
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ npm │ default │ N/A │ fork │ 0 │ 0 │ 90 │ errored │ 0% │ 0b │ Seth │ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\Seth\.pm2\pm2.log last 20 lines:
PM2 | 2022-06-20T00:21:32: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:32: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-06-20T00:21:32: PM2 log: App [npm:0] online
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] online
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] online
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] online
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] online
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-06-20T00:21:33: PM2 log: App [npm:0] online
PM2 | 2022-06-20T00:21:34: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-06-20T00:21:34: PM2 log: Script C:\PROGRAM FILES\NODEJS\NPM.CMD had too many unstable restarts (16). Stopped. "errored"
I got the same error on windows10
--- PM2 report ----------------------------------------------------------------
Date : Mon Aug 08 2022 22:55:17 GMT+0800 (香港标准时间)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.2.0
node version : 16.16.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\hugetiny\AppData\Roaming\nvm\v16.16.0\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 32min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.2.0
node version : 16.16.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Program Files\nodejs\node_modules\pm2\bin\pm2,report
argv0 : C:\Program Files\nodejs\node.exe
user : hugetiny
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i3-9100F CPU @ 3.60GHz
cpus nb : 4
freemem : 8180883456
totalmem : 17114234880
home : C:\Users\hugetiny
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user
│ watching │
├─────┼────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ npm │ default │ N/A │ fork │ 0 │ 0 │ 46 │ errored │ 0% │ 0b │ hugetiny
│ disabled │
└─────┴────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
[PM2][WARN] Current process list is not synchronized with saved list. App apify differs. Type 'pm2 save' to synchronize.
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\hugetiny\.pm2\pm2.log last 20 lines:
PM2 | 2022-08-08T22:48:28: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:28: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-08-08T22:48:28: PM2 log: App [npm:0] online
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] online
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] online
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] online
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-08-08T22:48:29: PM2 log: App [npm:0] online
PM2 | 2022-08-08T22:48:30: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:30: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2022-08-08T22:48:30: PM2 log: App [npm:0] online
PM2 | 2022-08-08T22:48:30: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-08T22:48:30: PM2 log: Script C:\PROGRAM FILES\NODEJS\NPM.CMD had too many unstable restarts (16). Stopped. "errored"