VSCode에서 Nodejs 디버깅
Debugging is the process of detecting and removing existing and potential errors (also called 'bugs') in a software code that can cause it to behave unexpectedly or crash.
⚙️ VSCode에서 노드 디버깅을 구성하려면 다음 단계를 따라야 합니다.
.vscode
를 만듭니다. launch.json
을 .vscode
폴더에 넣습니다. 이 파일은 디버깅을 위한 구성 파일이 됩니다. launch.json
내부에 이 코드를 입력해야 합니다.{
"configurations": [
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
}
]
}
💡 Tip: You can generate the same code by pressing the "Add configuration" button in VSCode bottom right corner.
After clicking the button, you will see a context menu where you should choose Node.js Attach to process.
Node.js Attach to process will bring you the same configuration as in step #3
그런 다음 VSCode의 실행 및 디버그 섹션으로 이동합니다.
![](https://s1.md5.ltd/image/4d4385dc0705c333e3eff6034b13a77c.png)
구성을 선택하고 시작을 누릅니다.
![](https://s1.md5.ltd/image/8db6cc62d03b3481c5a077d65ed09dab.png)
연결할 노드 프로세스를 선택해야 합니다. VSCode 내부에서 실행 중인 노드 애플리케이션이 가장 먼저 위치합니다.
![](https://s1.md5.ltd/image/00fd84b8d352da80d1809988c16c3cdc.png)
그러나 노드의 올바른 PID(프로세스 ID)를 찾지 못한 경우 정확한 로컬 호스트에서 실행 중인 프로세스의 ID를 표시하는 명령을 실행하는 것이 좋습니다.
macOS의 경우
sudo lsof -i :PORT
올바른 PID를 얻은 후 상황에 맞는 메뉴에 입력해야 합니다.
다음 기사에서 만나요 🥳
Reference
이 문제에 관하여(VSCode에서 Nodejs 디버깅), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/dealwith/debugging-nodejs-in-vscode-14jk텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)