How to fix Gulp open opens file instead of localhost:port

I recently stumbled upon this issue in Windows. I wanted to setup a new environment
and was building my gulp file. For some reason it always returned the file instead of the localhost, which caused script errors

By using the following gulp opens chrome correctly

var gulpOpen = require(‘gulp-open’);

gulp.task(‘open’, [‘connect’], function() {
gulp.src(‘./dist/index.html’)
.pipe(gulpOpen({uri: ‘http://localhost:7887’, app: ‘C:\\Program Files (x86)\\Google\\Chrome\\Application\\Chrome.exe’}))
.on(‘error’, console.error.bind(console))
});

 

For me using app: ‘Google Chrome’ did not work, so I replaced it with the entire filename

Another problem solved, now back to real work

Leave a comment