I am new to Gatsby, and I will be starting my first project today. I want to be able to test the site on my android phone to ensure mobile compatibility rather than using chrome dev-tools.
I have only ran a few commands so far.
1) Gatsby new site-name
2) cd site-name
3) gatsby develop --host 0.0.0.0 -p 8080
Everything compiles properly, and I can access the default Gatsby page through localhost:8080 or 192.168.1.81:8080 on the host laptop, but when i attempt to access from my android phone, it says that the server is unreachable. I am running windows 10 on my laptop, and so far Ive checked the firewall, and I've tried a few different ports as well. If someone has dealt with this issue and could help me that would be much appreciated!
I don't know why they blocked access by default :/ But you can access it by adding -H 0.0.0.0
to develop command. For example change your package.json to:
"develop": "gatsby develop -H 0.0.0.0",
you can fix this issue by using this command
gatsby develop -H 0.0.0.0
more information : from here
after you can use your pc ip address with the port number to debug gatsby site on your mobile
Example :
192.168.1.4:8000
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