CodeQ
CodeQ

Reputation: 463

how to debug the meanjs, node-inspector not opening debug?port=5858

I cloned the meanjs and running with npm install and grunt at the start up it shows debugger listening on port 5858, but when i open the chrome with

localhost:8080/debug?port=5858

it shows the webpage is not available. is there anything i need to do to make the node-inspector debugger to work for meanjs ?

Upvotes: 2

Views: 2426

Answers (2)

ocergynohtna
ocergynohtna

Reputation: 1702

Ok, if you're using the Gruntfile from the Yeoman Generator (meanjs.org) as I presume, just run grunt debug instead of simply grunt in your console. Then the node inspector will be available at http://localhost:1337/debug?port=5858 if you have default settings like:

watch: {
  serverViews: {
    files: watchFiles.serverViews,
    options: {
      livereload: true
    }
  },
  serverJS: {
    files: watchFiles.serverJS,
    tasks: ['jshint'],
    options: {
      livereload: true
    }
  },
  clientViews: {
    files: watchFiles.clientViews,
    options: {
      livereload: true,
    }
  },
  clientJS: {
    files: watchFiles.clientJS,
    tasks: ['jshint'],
    options: {
      livereload: true
    }
  },
  clientCSS: {
    files: watchFiles.clientCSS,
    tasks: ['csslint'],
    options: {
      livereload: true
    }
  }
},
nodemon: {
  dev: {
    script: 'server.js',
    options: {
      nodeArgs: ['--debug'],
      ext: 'js,html',
      watch: watchFiles.serverViews.concat(watchFiles.serverJS)
    }
  }
},
'node-inspector': {
  custom: {
    options: {
      'web-port': 1337,
      'web-host': 'localhost',
      'debug-port': 5858,
      'save-live-edit': true,
      'no-preload': true,
      'stack-trace-limit': 50,
      'hidden': []
    }
  }
},
concurrent: {
  default: ['nodemon', 'watch'],
  debug: ['nodemon', 'watch', 'node-inspector'],
  options: {
    logConcurrentOutput: true,
    limit: 10
  }
}

And the main cli tasks are defined at the bottom of the gruntfile:

// Default task(s).
grunt.registerTask('default', ['lint', 'concurrent:default']);

// Debug task.
grunt.registerTask('debug', ['lint', 'concurrent:debug']);

Upvotes: 9

Mihnea Simian
Mihnea Simian

Reputation: 1103

You need to start the node inspector server, that one will listen on 8080:

node-inspector

Then you're ready to hit the debug URL

Upvotes: 0

Related Questions