gulp localhost Cannot GET /

Kevin Hamil picture Kevin Hamil · Apr 3, 2015 · Viewed 14.9k times · Source

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.

Answer

Fred K picture Fred K · Mar 15, 2016

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