How To Have Expo Web Open In A Web Browser With Localhost?
Asked Answered
S

3

5

Running npm start or expo start launches the project as follows:

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.

Launching the Expo web by pressing ‘w’ opens Chrome browser with the IP address URI http://157.201.29.49:19006/ as advised.

However because of the office VPN, Chrome browser fails to resolve the address. The error is:

This site can’t be reached
ERR_CONNECTION_TIMED_OUT

Replacing the URL in Chrome with http://localhost:19006 succeeds.

How can I start Expo such that pressing ‘w’ automatically launches with localhost rather than the IP address?

Symphonic answered 29/1, 2020 at 13:58 Comment(1)
expo start then open in chrome : localhost:19002Radmen
S
5

To fix, launch expo directly as follows supplying the localhost option:

expo start —-localhost

See Expo CLI docs for expo start:

--localhost Same as --host localhost
Symphonic answered 29/1, 2020 at 13:58 Comment(1)
expo start was helpful thank youVicarial
I
7

It is no longer supported.

Update July 25, 2022: [email protected] has been released with the web UI removed. The last release to include the web UI is [email protected].

learn more

Interblend answered 20/1, 2023 at 9:17 Comment(1)
Thank you for this I was so confusedApodaca
S
5

To fix, launch expo directly as follows supplying the localhost option:

expo start —-localhost

See Expo CLI docs for expo start:

--localhost Same as --host localhost
Symphonic answered 29/1, 2020 at 13:58 Comment(1)
expo start was helpful thank youVicarial
L
2
expo start --web

or

npm run web
Lacker answered 21/12, 2022 at 6:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.