Skip to main content

Debugging & Troubleshooting

  • Copy and paste the error into Google.

Build Errors

  • Ensure that you have the correct dependencies in your package.json and run a npm install

Exercises

Debugging

Express Application

  • Use VS Code's Debug tools VS Code Debug
  • Select the node file you want to run. ie. index.js
  • Add a configuration for the application, by clicking the dropdown next to the play Debug and select Add Configuration and select Node
  • It should autofill with the details of the project and look like the following:
    {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
    "type": "node",
    "request": "launch",
    "name": "Express App",
    "skipFiles": ["<node_internals>/**"],
    "program": "${workspaceFolder}/index.js"
    }
    ]
    }
  • Hit the play debug button to run the application
  • Place breakpoint in the application to stop the application to view the line.

Exercises

Using Breakpoints In Chrome DevTools

  • Click the Sources tab.
  • Open the file containing the line of code you want to break on.
  • Go the line of code.
  • To the left of the line of code is the line number column. Click on it. A blue icon appears on top of the line number column. A line-of-code breakpoint.

Exercises

Resources