Gulp连接不运行服务器

我创build了gulpfile.js,并在其中使用了gulp-connect

gulp.task('connect', function(){ connect.server({ root: 'dev', livereload: true, port: 8000 }); }) 

当我运行gulp connect它不维护我的服务器localhost:8000

 [14:08:51] Starting 'connect'... [14:08:51] Server started http://localhost:8000 [14:08:51] LiveReload started on port 35729 [14:08:51] Finished 'connect' after 13 ms 

因此,当打开http://locahost:8000时,我什么也得不到

我能做些什么来使连接工作,并创build一个服务器来部署我的HTML?

我有同样的问题,我通过在服务文件夹(我的dist目录)中有多个文件解决它。 我不知道它为什么会起作用,但之后就开始工作了。

我使用了以下设置:

 gulp.task('connect', function(){ connect.server({ root: ['dist'], port: 8000, base: 'http://localhost', livereload: true }); 

我使用gulp-connect的v2.2.0。

gulp-connect已被弃用。

您可能希望使用名为gulp-webserver的重写包。