javascript - gulp-livereload with vagrant environment : livereload.js not accessible -
i have problem using gulp-livereload
in vagrant environment (generated puphpet). computer windows host, , vm debian.
i use gulpfile :
var gulp = require('gulp'), less = require('gulp-less') lr = require('tiny-lr'), livereload = require('gulp-livereload'), server = lr() ; gulp.task('less', function () { gulp.src('assets/less/*.less') .pipe(less()) .pipe(gulp.dest('build/css')) .pipe(livereload(server)) ; }); gulp.task('watch', function() { gulp.watch('assets/less/*.less', ['less']); livereload.listen(35729, function(err){ if(err) return console.log(err); }); }); gulp.task('default', ['watch', 'less']);
and when chrome extension add magic js file obtain message :
failed load resource: net::err_connection_timed_out http://markup.dev:35729/livereload.js?ext=chrome&extver=0.0.5
but in vm, if run following command line,
wget http://localhost:35729/livereload.js?ext=chrome&extver=0.0.5
i don't have enough information certain, guess problem trying access page host, livereload port isn't forwarded (the vm has it's own ip address , vagrant can configured forward ports host "appear" local on host).
try adding following line vagrantfile
:
config.vm.network "forwarded_port", guest: 35729, host: 35729
(for documentation see: https://docs.vagrantup.com/v2/networking/forwarded_ports.html)
alternatively if directly hitting vm (that have markup.dev
mapped guest's ip) may worth verifying there not firewall configured on vm might block livereload port external access.
Comments
Post a Comment