BrowserSync不断地使用Express / Gulp进行GET
我正在运行Express服务器,并使用browserSync监视更改。 当我运行npm start
,它开始运行一个吞咽任务:
// Server task gulp.task('server', function(cb) { // We use this `called` variable to make sure // the callback is only executed once var called = false; return nodemon({ script: 'server.js', watch: ['server.js', 'app/**/*.js', 'config/**/*.js'] }) .on('start', function onStart() { if (!called) { cb(); } called = true; }) .on('restart', function onRestart() { // Also reload the browsers after a slight delay setTimeout(function reload() { browserSync.reload({ stream: false }); }, 500); }); }); // BrowserSync gulp.task('browser-sync', ['server'], function() { browserSync.init({ // All of the following files will be watched files: ['public/**/*.*'], // Tells BrowserSync on where the express app is running proxy: 'http://localhost:3000', port: 4000, open: false, notify: false, logPrefix: project.name, logConnections: false, logLevel: 'silent' }); });
但是,在terminal窗口中,不断显示以下内容:
GET /browser-sync/socket.io/?EIO=3&transport=polling&t=1428091521010-28291 200 10.482 ms - - GET /browser-sync/socket.io/?EIO=3&transport=polling&t=1428091521032-28292 200 10.573 ms - - GET /browser-sync/socket.io/?EIO=3&transport=polling&t=1428091521053-28293 200 8.754 ms - - GET /browser-sync/socket.io/?EIO=3&transport=polling&t=1428091521082-28294 200 7.013 ms - - GET /browser-sync/socket.io/?EIO=3&transport=polling&t=1428091521110-28295 200 8.339 ms - - GET /browser-sync/socket.io/?EIO=3&transport=polling&t=1428091521134-28296 200 12.367 ms
这是什么原因造成的? 我怎样才能解决这个问题?
我面临同样的问题。 退出powershell
并restarting firefox
解决了这个问题。
希望这可以帮助!