Code Monkey home page Code Monkey logo

Comments (25)

cedeber avatar cedeber commented on August 16, 2024 47

Using gulp.src('./') solved my problem about getting files content.

from gulp-webserver.

itsmhuang avatar itsmhuang commented on August 16, 2024 20

Removed directoryListing completely and it now opens index.html automatically.

gulp.src("build")
    .pipe(webserver({
        livereload: true,
        fallback: "index.html",
        port: 8080,
        open: true
    }));

from gulp-webserver.

MoOx avatar MoOx commented on August 16, 2024 5

related to #14. Just removing the directoryListing option fix the root for me.

from gulp-webserver.

animabear avatar animabear commented on August 16, 2024 5

#5 solve this problem. Using this setting:

directoryListing: {
    enable:true,
    path: 'app'
}

from gulp-webserver.

scottyantipa avatar scottyantipa commented on August 16, 2024 5

I fixed this issue with the following gulp task.

gulp.task 'webserver', ->
  gulp.src 'public'
    .pipe webserver(
      fallback:   'index.html' # gulp-webserver needs this for html5
      livereload: true
      open:       true
      directoryListing:
        enable: true
        path:   'public'
      )

from gulp-webserver.

mii9000 avatar mii9000 commented on August 16, 2024 4

As @cedriceberhardt mentioned, using gulp.src('./') works. Apparently, this points to root rather than gulp.src('root')

from gulp-webserver.

hinok avatar hinok commented on August 16, 2024 1

We have exactly the same problem!
It's weird cause when I run only one task:

gulp webserver

The server works, but with multiple tasks is broken.
0.5.0 works like a charm.

from gulp-webserver.

thescientist13 avatar thescientist13 commented on August 16, 2024 1

I ran into this issue working on my second or third gulp project on my machine. The last two projects I've started exhibit this issue, while the very first one still works. I've even tried copy pasting in the code and I still get the issue of the 404 and the src being the root of my projects. Changing ports doesn't make it work.

However, as @hinok mentioned, just running the webserver task standalone does work

from gulp-webserver.

bialikover avatar bialikover commented on August 16, 2024 1

Note to consider... when you set directoryListing: true renders only the root directory, regardless of the src path you specify in gulp.src('whateverPathYouChoose') so I had to specify an object to make it work properly and render my static files correctly.

something like this:

directoryListing: {
        enable: true,
        path: 'example'
},

You may want to include that in the readme, and provide a better explanation.

from gulp-webserver.

scoutrul avatar scoutrul commented on August 16, 2024 1
> gulp.src('./app')
>     .pipe(server({
>         open: true,
>         fallback: 'index.html',
>         livereload: true,
>         directoryListing: {
>                 enable: true,
>                 path: './app'
> }

now this working for me except one problem - index.html doesn't open automaticly

from gulp-webserver.

robbiet480 avatar robbiet480 commented on August 16, 2024

Also having this problem :(

from gulp-webserver.

schickling avatar schickling commented on August 16, 2024

Sorry guys this is related to this PR: #5

I try to fix it as soon as I get the chance. Please feel free to commit a PR on your own to solve this problem. 👍

from gulp-webserver.

MCTaylor17 avatar MCTaylor17 commented on August 16, 2024

I ran into this problem with gulp-connect which is how I found this project. The fact that I have the exact same problem with both makes me think the issue is with a setting on my computer.

I tried 0.5.0 based on Hinok's comment but no luck.

Definitely looking forward to solving this one.

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

@schickling I was trying to fix this issue and was wondering, how should this function when you pass an array of paths or glob to the gulp.src?

For example, if I have:

gulp.src(['dist', 'coverage']).pipe(webserver({...}));

from gulp-webserver.

davejlong avatar davejlong commented on August 16, 2024

Just a note, by simply moving the line

if (config.directoryListing.enable) {
    app.use(serveIndex(path.resolve(config.directoryListing.path), config.directoryListing.options));
}

Inside the through.obj function argument and changing config.directoryListing.path to file.path, will make it so the directory listing sort of works. It only shows the first path for an array of files in gulp.src.

from gulp-webserver.

elmarkou avatar elmarkou commented on August 16, 2024

But this will only solve to serve content from the root, not if you specify a specific path

from gulp-webserver.

agross avatar agross commented on August 16, 2024

+1

from gulp-webserver.

moneytree-doug avatar moneytree-doug commented on August 16, 2024

My public and dist folder are siblings, so I am trying to serve the root directory, but I keep getting a CANNOT GET public/index.html error.

gulp.task('webserver', function() {
  gulp.src('root')
    .pipe(webserver({
        open: true,
        fallback:   'index.html',
        livereload: true,
        directoryListing: {
            enable: true,
            path: 'example'
        }
    }));
});

However, I can serve my public folder properly when my src is public, but I won't be able to reference my JavaScript in my dist folder. Any suggestions?

from gulp-webserver.

TeodorKolev avatar TeodorKolev commented on August 16, 2024

I have tried all of this solutions and none of them works for me. Whatever I do I get Cannot Get

from gulp-webserver.

toymachiner62 avatar toymachiner62 commented on August 16, 2024

Any progress on this? gulp-webserver is useless without this working.

from gulp-webserver.

konekoya avatar konekoya commented on August 16, 2024

changing my settings from

directoryListing: true

to

directoryListing: {
  enable: true,
  path: 'app'
}

works for me

from gulp-webserver.

atais avatar atais commented on August 16, 2024

@frontools solution works 👍

from gulp-webserver.

codemansam avatar codemansam commented on August 16, 2024

This worked for me. Set open to the complete path rather than true

  	open: 'http://localhost:8000/index.html'

from gulp-webserver.

rafaelblink avatar rafaelblink commented on August 16, 2024

@itsmhuang Thanks!!

from gulp-webserver.

JonyBlack avatar JonyBlack commented on August 16, 2024

@itsmhuang Thanks!!
http://localhost:8000/#!/home

from gulp-webserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.