简体   繁体   English

npm live服务器未在移动设备上运行

[英]npm live-server not running on mobile

Everything runs correctly when I start the npm live-server from my laptop, but when I type the address on the iPhone's browser 127.0.0.1:8080 it says the address can't be found. 当我从笔记本电脑启动npm live-server时,一切正常运行,但是当我在iPhone浏览器中输入地址127.0.0.1:8080时,它说找不到该地址。

I remember before that when running the live server from the terminal you can also see the web page from mobile too. 我记得在此之前,从终端运行实时服务器时,您也可以从移动设备上看到网页。 I'm not using file:// to run the page. 我没有使用file://来运行页面。

Appreciate the help. 感谢帮助。 Thanks 谢谢

根据文档页面 ,我可以看到它看起来像ng serve一样工作,您需要添加参数--host 0.0.0.0以使服务器绑定到所有IP,而不仅仅是127.0.0.1(这是无法访问的)通过手机)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM