最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Gulp Connect not running server - Stack Overflow

programmeradmin2浏览0评论

I created the gulpfile.js and in it has a use for gulp-connect

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

When I run gulp connect it does not maintain my server on 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

Hence I get nothing when opening up http://locahost:8000

What can I do to make connect work and create a server to deploy my html?

I created the gulpfile.js and in it has a use for gulp-connect

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

When I run gulp connect it does not maintain my server on 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

Hence I get nothing when opening up http://locahost:8000

What can I do to make connect work and create a server to deploy my html?

Share Improve this question asked Jul 11, 2014 at 21:15 dazerdazer 2231 gold badge4 silver badges14 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

I had the same problem and I resolved it by having more than one file in the served folder (my dist directory). I don't know why it works but it started working after that.

I used the following settings:

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

I use v2.2.0 of gulp-connect.

gulp-connect has been deprecated.

You may wish to use the rewritten package called gulp-webserver.

发布评论

评论列表(0)

  1. 暂无评论