title: Not able to run typescript node.js app with ts-node with pm2
body: <p>I have created a basic node app with typescript top of it. I am using ts-node to do so and it's working totally fine with nodemon. But I need to move it to the server now I am stuck. PM2 is showing error all the time. I have gone through GitHub and other answers on StackOverflow. Nothing helped me here. please help.</p>
  
  <p>I have tried installing typescript and ts-node with PM2. But It did not work for me. I also have tried running file directly, not worked. I am clueless now how should I fix this. </p>
  
  <pre><code> "scripts": {
      "start": "nodemon -x ts-node src/server.ts"
    },
  </code></pre>
  
  <p><strong>It works fine with simple npm run start command</strong></p>
  
  <pre><code>madbo@DESKTOP-CS5UFKE MINGW64 /e/shailesh/nodejs/NodeType
  $ npm run start
  
  &gt; NodeType@1.0.0 start E:\shailesh\nodejs\NodeType
  &gt; nodemon -x ts-node src/server.ts
  
  [nodemon] 1.18.5
  [nodemon] to restart at any time, enter `rs`
  [nodemon] watching: *.*
  [nodemon] starting `ts-node src/server.ts`
  24 Mar 22:33:23 - listening on port 3000
  Mongoose default connection is open to  mongodb://localhost:27017/todo 
  
  </code></pre>
  
  <p><strong>What I have tried so far that didn't work</strong> <strong>*( PM2 is globally installed) *</strong></p>
  
  <pre><code>pm2 start ts-node -- --type-check -r tsconfig-paths/register src/server.ts
  </code></pre>
  
  <p><strong>It gave me this error</strong></p>
  
  <pre><code>madbo@DESKTOP-CS5UFKE MINGW64 /e/shailesh/nodejs/NodeType
  $ pm2 start ts-node -- --type-check -r tsconfig-paths/register src/server.ts
  [PM2][ERROR] script not found : E:\shailesh\nodejs\NodeType\ts-node
  script not found : E:\shailesh\nodejs\NodeType\ts-node
  ┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
  │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
  └──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
   Use `pm2 show &lt;id|name&gt;` to get more details about an app
  
  </code></pre>
  
  <p><strong>I have also used the following</strong></p>
  
  <pre><code>pm2 start npm  -- ts-node src/server.ts
  </code></pre>
  
  <p>and got</p>
  
  <pre><code>$ pm2 start npm  -- ts-node src/server.ts
  [PM2] Applying action restartProcessId on app [npm](ids: 0)
  [PM2] [npm](0) ✓
  [PM2] Process successfully started
  ┌──────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬───────┬──────────┐
  │ App name │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user  │ watching │
  ├──────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼───────┼──────────┤
  │ npm      │ 0  │ N/A     │ fork │ 11300 │ online │ 15      │ 0s     │ 0%  │ 21.5 MB   │ madbo │ disabled │
  └──────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴───────┴──────────┘
   Use `pm2 show &lt;id|name&gt;` to get more details about an app
  
  madbo@DESKTOP-CS5UFKE MINGW64 /e/shailesh/nodejs/NodeType
  $ pm2 status
  ┌──────────┬────┬─────────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬───────┬──────────┐
  │ App name │ id │ version │ mode │ pid │ status  │ restart │ uptime │ cpu │ mem    │ user  │ watching │
  ├──────────┼────┼─────────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼───────┼──────────┤
  │ npm      │ 0  │ N/A     │ fork │ 868 │ stopped │ 24      │ 0      │ 0%  │ 0 B    │ madbo │ disabled │
  └──────────┴────┴─────────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴───────┴──────────┘
   Use `pm2 show &lt;id|name&gt;` to get more details about an app
  
  </code></pre>
  
  <p><strong><em>Please help me fixing this</em></strong></p>
  
  <p>I want it to be working on a server with pm2 on the server. I will be great full if anyone of you can fix my problem. Thanks</p>