Simha Chalam
Simha Chalam

Reputation: 591

How to execute the break points when debug in Node.js?

I am using Electron (front-end) and Node.js (Sails back-end). Both are in TypeScript(ES6).

I want to debug Sails application controller.

I selected some break points in the application (back-end) using WebStorm.

enter image description here

Upvotes: 0

Views: 86

Answers (1)

lena
lena

Reputation: 93728

Gulp run configuration is not supposed to be used for Node application debugging - it was designed to run/debug Gulp tasks. To debug your Node.js application, you need to create a Node.js Run configuration (see http://www.sullivansoftdev.com/blog/2014/04/12/debugging-sails-applications-with-webstorm/ for some hints)

If you still prefer using Gulp to start your server, make sure that server process is started with --debug-brk (for Node version <= 6.x) or --inspect-brk and then use either Node.js Remote (Node <= 6.x) or Chromium Remote (Node.6.x) run configuration to attach the debugger.

Like:

var gulp = require('gulp');
var exec = require('child_process').exec;

gulp.task('server', function (cb) {
  exec('node --debug-brk=5858 app.js', function (err, stdout, stderr) {
...

run your server task, then select Node.js Remote/Chromium Remote run configuration and hit Debug

Upvotes: 2

Related Questions