7

First of all, I'm following Menno Pietersen's tutorial on Rapid MODx Workflow. I'm pretty positive I've followed it accurately, but for some reason when I do 'gulp watch' in my project folder I get a blank localhost:3000 page showing "Cannot GET /".

I'm not that familiar with all of the moving parts here, so I'm not sure where to even start as to why I'm getting this error instead of seeing my site. I've Googled it and come up with various other isses that don't seem related to my setup and/or tools used... and I've tried poking around myself and figuring it out, but I'm just spinning my wheels at this point.

Has anyone else tried this setup and encountered this? Or possibly have any idea where I should start?

I appreciate the help. I can give further information if need be. Thanks.

NOTE: If I put an index.html file in the project root then it displays that, but I'm not sure why it's not showing the modx site or how to fix it so it does.

UPDATE: I figured out that in my gulpfile.js, the gulp.task browser-sync was setup to use 'baseDir'.. I commented that out and used the proxy option and set it to 'localhost'. Fixed.

Kevin Hamil
  • 81
  • 1
  • 1
  • 8
  • @Vasis Yes, that's the same tutorial I referenced in my post, but I did figure how to fix the issue. Updated my post. Thanks for the response. – Kevin Hamil Apr 04 '15 at 01:50
  • @KevinHamil the proxy options is used if you run you're running your project through some vhost like Visual Studio, Eclipse, Ruby server, etc... then you use proxy to point browsersync to those URLs. if you're doing just frontend (html+css+js) you should be able to use the server option instead – Felipe Skinner Apr 23 '15 at 20:58

3 Answers3

8

Basic settings for BrowserSync include a built-in static server that works for basic HTML/JS/CSS websites (see documentation).

server: {
    baseDir: "app"
}

Remove that and use the proxy option. Like this:

// Using a vhost-based url
proxy: "local.dev"

Check docs for the full list of accepted url types

Fred K
  • 13,249
  • 14
  • 78
  • 103
3

I solve this issue

gulp.task('serve', function() {
    browserSync.init({
       proxy: "http://localhost/mydir"
    });
});
Brett Gregson
  • 5,867
  • 3
  • 42
  • 60
danu
  • 31
  • 6
0

I encountered this error after mistakenly running gulp from the wrong directory. Double check you're in a directory with a copy of gulpfile.js.

brogrammer
  • 804
  • 1
  • 12
  • 22