简体   繁体   中英

How to run pm2 with node.js ts on debug mode and break on WebStorm

I use latest version of all.

This is my pm2.json

{
  "name": "testapi",
  "script": "ts-node",
  "args":["/src/index.ts"],
  "watch": [
    "src"
  ],
  "ignore_watch":["node_modules"],
  "env": {
    "PORT": 3333,
    "NODE_ENV": "development",
    "NODE_OPTIONS": "--inspect"
  },
  "inspect": true
}

But I can't debug it from WebStorm with breakpoints. What do I need to do?

This is not the answer for your question, but could help you if you need debug.

I think pm2 is for deploy environments, so, you could just run your app in debug mode with webstorm, after transpile the code to JS, you could select your index and add a server, then start that server in debug mode.

After you have everything working, you could start the server with pm2.

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM