Skip to content

Debugging HowTo

Flynn Duniho edited this page May 29, 2024 · 2 revisions

WIP

Debugging Client in Browser

in build directory, npm run dev

  • open javascript console
  • look for messages
  • look for lists of console-accessible debug commands (tbd)
  • edit source modules to enable DBG flag
  • set breakpoint on exceptions in debugger

Debugging Client + Server

To debug server files, use npm run debug. This will start our custom server with Node Inspector. This will allow you to debug Node programs using Chrome's debugging tools:

  • Start debugging the server with npm run debug
  • Open Chrome and browse to chrome://inspect
  • Connect to the instance, OR connect to a global Node debugger instance

Implementation Details

The 'debug' script (defined in package.json) invokes a modified version of the brunch shell script that is installed by npm install -g brunch. This is a nodejs file so it is easily modified. Our modifications:

  • update the undocument BRUNCH_DEVTOOLS parameters to disable break-on-start
  • print additional helpful notes

Catching Syntax Errors

Brunch hides the actual line numbers and script where the error occurs, so it is difficult to track down. To work through mystery errors, start debugging without brunch as follows:

  • Make sure you are in the build directory
  • node --inspect brunch-server.js

You should see more useful reporting of where the syntax errors are occuring, even if there are in other modules other than brunch-server.js

Clone this wiki locally