Running Nodemon and Node Inspector with Gulp

Written by David O'Dey on Jun 18, 2016

Nodemon and node-inspector are two must-have tools if you’re using node.js. You can manually start nodemon or node-inspector using two separate console windows, or you can do it a more efficiently using gulp.js. It took me some time to get everything setup the way I wanted it so I’m hoping this post will save you some effort.

Assuming your using gulp.js as your build system, lets install both gulp-nodemon and gulp-node-inspector using npm. I prefer to install the files locally to the project, but if you like you can install them globally using the -g flag. Use your console to navigate to your project folder, and run the following commands:

$ npm install gulp-nodemon --save-dev
$ npm install gulp-node-inspector --save-dev

After your plugins are installed we need to setup your gulpfile.js.

// require plugins
var gulp = require('gulp'),
    nodeInspector = require('gulp-node-inspector'),
    nodemon = require('gulp-nodemon');

gulp.task('nodemon', function () {
    // location of webserver module
    script: './src/app',  
    ext: 'js',
    // enter any tasks you want to run before refreshing the server
    tasks: ['jshint'],  
    //important must pass the debug flag to work
    nodeArgs: ['--debug']  

gulp.task('node-inspector', ['nodemon'], function() {
      debugPort: 5858,
      webHost: '',
      webPort: 8080,
      saveLiveEdit: false,
      preload: true,
      inject: true,
      hidden: [],
      stackTraceLimit: 50,
      sslKey: '',
      sslCert: ''

gulp.task('default', function() {

You’re all set, just type $ gulp in your console. If you use the same settings in this gulpfile.js, and your app is running on port 3000 you can open to access your webserver and to access your node debugger.

To download the example used in this project you can checkout the files on Github.

For more information: