javascript - The port is occupied when restarting the express server using gulp-nodemon
漂亮男人
漂亮男人 2017-06-14 10:51:53
0
1
1171

// 定义web服务模块,增加浏览器同步浏览
gulp.task('browser-sync', ['nodemon'], function () {
    console.log("自动自行刷新-------------------------");
  browsersync.init(null, {
    proxy: 'http://localhost:3000',
    browser: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ,//在谷歌下面打开
    notify: false,
    port: 3001,
    files: [dist.root+"**/*"]
  });
  
});


gulp.task('nodemon', function (cb) {
  var called = false;

  return nodemon({
    script: 'bin/www'  
  }).on('start', function () {
    if (!called) {
      cb();
      called = true;
    }
  });
});

How to use gulp-nodemon internal deletion to restart the express server

漂亮男人
漂亮男人

reply all(1)
仅有的幸福

Nodemon itself can monitor js file changes and automatically restart the nodejs service. nodemon only needs to be started once.

browser-sync task, no need to start nodemon every time.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template