Reputation: 98
I just started using angular2 on my vagrant machine and live reload didnt work initially, so I installed a vagrant plugin "vagrant-fsnotify" which seems to fix the file change detection by compiler but not the browser reload.
using ng serve --host 0.0.0.0
Node : 6.11.4, Angular cli : 1.4.5, Vagrant box : Ubuntu 14.04
Upvotes: 4
Views: 1067
Reputation: 98
I was able to fix this issue by setting port forward
config.vm.network "forwarded_port", guest: 4200, host: 4200
You will also need to install vagrant plugin vagrant-fsnotify. One way is to add this at the top of your vagrant file
required_plugins = %w( vagrant-fsnotify )
required_plugins.each do |plugin|
system "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin
end
Run ng serve like this:
ng serve --host 0.0.0.0
Upvotes: 1