Skip to content

Instantly share code, notes, and snippets.

@cmckni3
Last active June 9, 2026 19:59
Show Gist options
  • Select an option

  • Save cmckni3/c0429eada7a16813d182e5ce10a7ace2 to your computer and use it in GitHub Desktop.

Select an option

Save cmckni3/c0429eada7a16813d182e5ce10a7ace2 to your computer and use it in GitHub Desktop.
VS Code Angular debugger configuration
  1. Install node.js and optionally yarn
  2. Install and open Visual Studio Code
  3. Install chrome debugging extension for Visual Studio Code
  4. Install @angular/cli npm i -g @angular/cli OR yarn global add @angular/cli
  5. Create a new project ng new my-project
  6. Open project in Visual Studio Code
  7. Debug > Add configuration
  8. Paste contents of launch.json into the new launch.json configuration file.
  9. Start project ng serve optionally changing the port with -p <value> or --port. Remember to change the port in launch.json first since Visual Studio Code will reload and stop all programs running in the builtin terminal.
  10. Debug > Launch Chrome against localhost
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceRoot}"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"webRoot": "${workspaceRoot}"
}
]
}
@blowysrl

blowysrl commented Aug 28, 2024

Copy link
Copy Markdown

Thank you very much! I was searching for this exact same tutorial. You are a blessing :D

Also for the people like me who are following various fullstack tutorial, if the folder .vscode is in a upper position of your angular project (the folder you create with "ng new nameOfTheProject") you have to edit the configuration as such:

{
    "version": "0.2.0",
    "configurations": [
    
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceRoot}/nameOfYourProject"
        },
        {
            "type": "chrome",
            "request": "attach",
            "name": "Attach to Chrome",
            "port": 9222,
            "webRoot": "${workspaceRoot}/nameOfYourProject"
        }
    ]
}

@cmckni3

cmckni3 commented Dec 31, 2024

Copy link
Copy Markdown
Author

Thank you very much! I was searching for this exact same tutorial. You are a blessing :D

@blowysrl , thanks for taking the time to share feedback. I appreciate the note that the webRoot for Angular projects may differ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment