【问题标题】:How To Have Expo Web Open In A Web Browser With Localhost?如何在带有 Localhost 的 Web 浏览器中打开 Expo Web?
【发布时间】:2020-05-15 01:02:39
【问题描述】:

运行npm startexpo start 启动项目如下:

React  You can now view My React Native App in the browser.

  Local:            http://localhost:19006/   On Your Network:  http://157.201.29.49:19006/

Note that the development build is not optimized.

 › To create a production build, run expo build:web  › Press Ctrl+C to exit.

 Expo  Press ? to show a list of all available commands.

按“w”启动 Expo Web 会按照建议打开带有 IP 地址 URI http://157.201.29.49:19006/ 的 Chrome 浏览器。

但由于办公 VPN 的原因,Chrome 浏览器无法解析地址。错误是:

无法访问此网站
ERR_CONNECTION_TIMED_OUT

将 Chrome 中的 URL 替换为 http://localhost:19006 成功。

我怎样才能启动 Expo,以便按“w”自动启动 localhost 而不是 IP 地址?

【问题讨论】:

标签: react-native vpn expo expo-web


【解决方案1】:

要修复,请直接启动 expo,如下提供 localhost 选项:

expo start —-localhost

Expo CLI docsexpo start

--localhost Same as --host localhost

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    • 1970-01-01
    • 2012-08-11
    • 1970-01-01
    • 2020-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多