Gulp -nodemon - restarting the node after reloading the file - Error: listen to EADDRINUSE events.js: 85

I am running nodejs 0.12.3 - gulp 3.10.8 and Gulp -nodemon 2.0.3. gulpfile.js:

gulp.task('serve', ['build'], function() {
  gulp.start('fb-flo');
  nodemon({
    script:   paths.server,
    env:      { 'NODE_ENV': 'development' },
    // env: { 'NODE_ENV': 'production' },
    execMap:  {
      'js': 'node_modules/babel/bin/babel-node --stage 1' //ES7 cote server
    },
    delay:    '0ms',
    watch:    ['src/shared/', 'src/server/'],
    ignore:   ['src/shared/components'],
    tasks: function (changedFiles) {
      var tasks = [];
      changedFiles.forEach(function (file) {
        if (path.extname(file) === '.jsx' && !~tasks.indexOf('bundlejs')) tasks.push('bundlejs');
        if (path.extname(file) === '.less' && !~tasks.indexOf('compileless')) tasks.push('compileless');
      });
      return tasks;
    }
  }).on('exit', function(){
    //console.log(process._getActiveHandles());
    //console.log(process._getActiveRequests());
    process.once('SIGUSR2', function () {
      console.log('exit!...........');
      gracefulShutdown(function () {
        process.kill(process.pid, 'SIGUSR2');
      });
    });
  });
});

My server starts up well, but when I reboot after changing the js files in src / shared or src / server, I have an error:

[14:22:35] Finished 'default' after 4.4 μs
[14:22:35] [nodemon] exiting
events.js:85
  throw er; // Unhandled 'error' event
        ^
Error: listen EADDRINUSE

I understand that this means that the address is used during the day, as you can see that I tried to clear when I exit the SIGUSR2 signal, but console.log is never called ... Any help I liked! Thanks

+4
source share

All Articles