Trying to setup angular on a virtual machine with yeoman to avoid breaking my machine with the packages management.
After generate the project with yo myproject
, install angular globally & locally, install grunt with bower and more dependencies, I'm able to run the server using grunt serve
The localhost
is accessible from the VM via wget localhost
, but it does not load from the host.
I've tried modifying the file /etc/network/interface
to static address and accessing the static IP from a browser, and also to set dynamic DHCP with port forwarding
None have worked, the browser can't make a connection:
Firefox can't establish a connection to the server at
I would like to upload more useful files/output to give more context, but as a new grunt user I have no idea where to look.
set connect-middleaware listen on 0.0.0.0 ip address to ensure host accessible.
You can edit your Gruntfile.js like this.
Find connect
task in grunt.initConfig({});
change the hostname in the options
to 0.0.0.0
It should look like this:
// The actual grunt server settings
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: '0.0.0.0',
livereload: 35729
},
livereload: {
options: {
open: true,
base: [
'.',
'examples'
]
}
}
},
run grunt serve
, try to use vm ip to access ip from host. it should available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With