Javascript/Node.js
[Node.js] vscode에서 pm2 start pm2.json 을 사용할 때 디버깅방법
skydev
2020. 1. 7. 18:03
1. 설정파일 추가
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"processId": "${command:PickProcess}"
}
]
}
2. pm2로 실행된 프로그램 pid 검색
pm2 pid app 실행하면 pid를 알아낼 수 있다.

3. vscode 디버깅 실행
vscode에서 Attach를 누르면 보이는 프로세스 선택창에서 위 단계에서 알아낸 pid프로세스를 선택하면 된다.
참고: https://medium.com/@ThreePotatoteers/debugging-expressjs-with-pm2-and-vscode-24761d0e72dc