javascript - gulp-nodemon 使用重启express 服务器的时候端口被占用
问题描述
// 定义web服务模块,增加浏览器同步浏览gulp.task(’browser-sync’, [’nodemon’], function () { console.log('自动自行刷新-------------------------'); browsersync.init(null, { proxy: ’http://localhost:3000’, browser: 'C:Program Files (x86)GoogleChromeApplicationchrome.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; } });});
怎么使用gulp-nodemon内部删除重新启动express服务器
问题解答
回答1:nodemon本身就可以做到监控js文件变化自动重启nodejs服务。nodemon只需要启动一次即可。
browser-sync任务,不需要nodemon每次都启动。
相关文章:
1. linux - 编译安装mysql 5.6.232. angular.js - vue中类似于angular的ng-change的指令是?3. node.js - vue服务端渲染如何部署到线上4. node.js - 微信的自动回复问题5. css3 - 请问一下在移动端CSS布局布局中通常需要用到哪些元素,属性?6. html5 - 在一个页面中 初始了两个swiper 不知道哪里错了 一直不对7. PHP能实现百度网盘的自动化么?8. centos6.5 - mysql 连接100609. 如何把3个不同的MySQL数据库数据整合到一个MySQL数据库中?10. MySQL 水平拆分之后,自动增长的ID有什么好的解决办法?
