You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running pm2 start with a ts-node script on Windows 10, I get an error inside ts-node. I don't have the issue when running the ts-node command directly from a Powershell
[PM2][WARN] Applications pier-admin-development not running, starting...
[PM2] App [pier-admin-development] launched (1 instances)
┌─────┬───────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼───────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ pier-admin-development │ default │ 1.0.0 │ fork │ 2248 │ 0 │ 1 │ stopped │ 0% │ 0b │ olivi │ enabled │
└─────┴───────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
(status=stopped and not errored) and pm2 logs:
PS D:\devts\pier\pier-admin-develop> pm2 logs
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
C:\Users\olivi\.pm2\logs\pier-admin-development-out.log last 15 lines:
C:\Users\olivi\.pm2\logs\pier-admin-development-error.log last 15 lines:
0|pier-adm | 2021-01-16T17:31:32: D:\devts\pier\pier-admin-develop\node_modules\.bin\ts-node-dev:2
0|pier-adm | 2021-01-16T17:31:32: basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
0|pier-adm | 2021-01-16T17:31:32: ^^^^^^^
0|pier-adm | 2021-01-16T17:31:32:
0|pier-adm | 2021-01-16T17:31:32: SyntaxError: missing ) after argument list
0|pier-adm | 2021-01-16T17:31:32: at wrapSafe (internal/modules/cjs/loader.js:979:16)
0|pier-adm | 2021-01-16T17:31:32: at Module._compile (internal/modules/cjs/loader.js:1027:27)
0|pier-adm | 2021-01-16T17:31:32: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
0|pier-adm | 2021-01-16T17:31:32: at Module.load (internal/modules/cjs/loader.js:928:32)
0|pier-adm | 2021-01-16T17:31:32: at Function.Module._load (internal/modules/cjs/loader.js:769:14)
0|pier-adm | 2021-01-16T17:31:32: at Object.<anonymous> (C:\Users\olivi\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:33:23)
0|pier-adm | 2021-01-16T17:31:32: at Module._compile (internal/modules/cjs/loader.js:1063:30)
0|pier-adm | 2021-01-16T17:31:32: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
0|pier-adm | 2021-01-16T17:31:32: at Module.load (internal/modules/cjs/loader.js:928:32)
0|pier-adm | 2021-01-16T17:31:32: at Function.Module._load (internal/modules/cjs/loader.js:769:14)
but running directly D:\devts\pier\pier-admin-develop\node_modules\.bin\ts-node-dev --files ./src/main.ts works fine...
EDIT: The same config works on Linux (Ubuntu & Raspbian)
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Sat Jan 16 2021 17:52:49 GMT+0100 (heure normale d’Europe centrale)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.5.0
node version : 14.15.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\olivi\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 46min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.5.0
node version : 14.15.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\olivi\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0 : C:\Program Files\nodejs\node.exe
user : olivi
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
cpus nb : 8
freemem : 1679581184
totalmem : 16953622528
home : C:\Users\olivi
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼───────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ pier-admin-development │ default │ 1.0.0 │ fork │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ olivi │ enabled │
└─────┴───────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
(I looked at #2675 but does not seem to be related)
The text was updated successfully, but these errors were encountered:
Got it: it's a matter of interpreter. The interperter is guessed automatically on Linux, not on Windows.
Furthermore, ts-node is a shell script ==> you must guess what is your shell interpreter in powershell.
I found one and added it in the ecosystem file:
interpreter: "C:\Program Files\Git\bin\bash.exe",
then it worked but there's a big drawback: I can't get that working on Linux anymore (prod envt).
And I don't understand why ts-node runs in a powershell terminal (it doesn't know the git shell)
Is there a way to define the interpreter differently depending on the OS ?
What's going wrong?
When running pm2 start with a ts-node script on Windows 10, I get an error inside ts-node. I don't have the issue when running the ts-node command directly from a Powershell
How could we reproduce this issue?
My ecosystem contains:
Running
pm2 start
gives:(status=stopped and not errored) and pm2 logs:
but running directly
D:\devts\pier\pier-admin-develop\node_modules\.bin\ts-node-dev --files ./src/main.ts
works fine...EDIT: The same config works on Linux (Ubuntu & Raspbian)
Supporting information
(I looked at #2675 but does not seem to be related)
The text was updated successfully, but these errors were encountered: