running typescript with pm2, node and ts-node as argument

18 Views Asked by At

This is the script to run typescript project:

node --require ts-node/register --loader=ts-node/esm --trace-warnings ./src/home-client.ts

With pm2, I tried:

pm2 start ./src/home-client.ts --node-args="--require ts-node/register --loader=ts-node/esm --trace-warnings"

Logs display an error: 0|home-cli | error: Script not found "ts-node/register"

Whats the correct way to run typescript project with pm2 and node?

1

There are 1 best solutions below

0
sanjihan On

Directly specifying node interpreter with --interpreter solved the issue.