Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Node/Express --- require('express') creates a break

My fairly limited experience with Node and Express doesn't help, but I'm having trouble debugging the app from the terminal window. Here is the issue:

running node debug app.js returns:

< debugger listening on port 5858
connecting... ok
break in server.js:1
    1 var express = require('express');

Is this the right way of debugging express apps?

like image 563
Gregory M Avatar asked Apr 30 '12 22:04

Gregory M


People also ask

How do I debug Node js express?

This is done with a left-click left to the line number. Let's to it on line 15, which should be the first line of our POST /users endpoint function. Then we start the debugger by clicking on Debug->Start Debugging at the top menu or by pressing F5. VS Code will start our application and the debugger for us.

How do you create a breakpoint in node?

When debugging in Node. js, we add a breakpoint by adding the debugger keyword directly to our code. We can then go from one breakpoint to the next by pressing c in the debugger console instead of n . At each breakpoint, we can set up watchers for expressions of interest.

How can you enable debugging in express js app?

Logging is turned off by default and can be conditionally turned on by using the DEBUG environment variable. To see all the internal logs used in Express, set the DEBUG environment variable to express:* when launching your app. On Windows, use the corresponding command.

Is a debugging tool for Nodejs?

Node Inspector is a reliable debugger for Node. js apps based on the Blink Developer Tools – a powerful JavaScript debugging interface.


1 Answers

There is a popular GUI debugger (leveraging WebKit, i.e. Chrome, Safari..).

You should give it a go https://github.com/dannycoates/node-inspector

like image 72
250R Avatar answered Oct 27 '22 06:10

250R