Table Of Contents
Intro
As a developer, you know that debugging is a crucial aspect of your workflow. It helps you identify and fix issues in your code, and ultimately improve your application's performance. However, the process of debugging can be time-consuming and tedious, especially if you have to manually restart your application every time you make a change. This is where Nodemon and Visual Studio Code Debugger come in handy.
Nodemon is a tool that helps you automate the process of restarting your Node.js application whenever you make changes to your code. It monitors your application for changes and automatically restarts it when it detects any modifications. This saves you a lot of time and effort, as you don't have to manually stop and start your application every time you make changes.
Visual Studio Code Debugger, on the other hand, is an integrated development environment (IDE) that provides a powerful debugging experience for Node.js applications. It allows you to set breakpoints, step through your code, and inspect variables and objects at runtime.
VSCode provides a configuration for nodemon (see image below), but I couldn't use it at first, so I had to update to the package path installed in "node_modules".
This is because the "nodemon" package is installed in the project, not globally.
So how do I do it?
The steps to integrate nodemon in VSCode debugger are:
- Install
nodemon
as development dependency in your repository:
npm install -D nodemon
# or
npm install --save-dev nodemon
- Configure the VSCode "launch.json" as follows, updating the value of
runtimeExecutable
:
{
"version": "0.2.0",
"configurations": [
{
"name": "nodemon",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"program": "${workspaceFolder}/app.js",
"request": "launch",
"restart": true,
// "runtimeExecutable": "nodemon", /* ORIGINAL VALUE */
"runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"type": "node"
}
]
}
And it done!
For your convenience I created this demo repository: andersonbosa/nodemon-vscode-tutorial
About • Technologies • Contribution • Author • License • Statistics
💬 About
This repository shows how to integrate the nodemon tool with the VSCode Debugger. For more details, see my https://dev.to/t4inha/how-to-use-nodemon-with-vscode-debugger-2bpa
🛠️ Technologies
🚀 Distribution
- Here in Github
🤝 Contribution
All kinds of contributions are very welcome and appreciated!
👨💻 Author
📝 License
This project is under the MIT license.
Do you know how to integrate other languages with the VSCode Debugger? Please share in the comments! All kinds of contributions are very welcome and appreciated.
Top comments (1)
Here is an amazing article from Bradley Kouchi: digitalocean.com/community/tutoria...