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內(nèi)部刪除重新啟動express服務器
問題解答
回答1:nodemon本身就可以做到監(jiān)控js文件變化自動重啟nodejs服務。nodemon只需要啟動一次即可。
browser-sync任務,不需要nodemon每次都啟動。
相關(guān)文章:
1. 在應用配置文件 app.php 中找不到’route_check_cache’配置項2. html按鍵開關(guān)如何提交我想需要的值到數(shù)據(jù)庫3. html - 微信瀏覽器h5<video>標簽問題4. html - css中怎么命名顏色比較好?5. objective-c - ios 怎么實現(xiàn)微信聯(lián)系列表 最好是swift6. 淺談vue生命周期共有幾個階段?分別是什么?7. html - 手機前端開發(fā)8. css3 - overflow 英文 會溢出9. java - 安卓接入微信登錄,onCreate不會執(zhí)行10. node.js - Vue+Webpack在dev環(huán)境下沒有問題build后出現(xiàn)莫名錯誤
