expo & react-native-web: Something went wrong, A network error occurred
Asked Answered
C

2

1

When run expo with react-native-web, the page show error in chrome:

Something went wrong
Error: A network error occurred.

But, when I open it in firefox, there is no error. At the same time, my android phone that connect to the app via expo also works well without error. So, only chrome has such issue, firefox and android don't.

I've tried following, but nothing solved the issue:

  • disabled all extensions in chrome, and reboot the computer, nothing changes.
  • confirmed that there is no proxy setting in my computer or chrome.
  • start chrome in incognito mode.
  • start app via expo start -c to clear cache.
  • remove .expo dir.
  • remove node_modules/ dir.

So, what's the possible issue ?

I've checked Can't load expo app: Something went wrong , no answer by others can solve my issue.

Screenshot in chrome: enter image description here

Cottar answered 5/4 at 20:34 Comment(3)
After a day, without code changes, chrome works now. I'm not sure what happened. Maybe it's some kinda of network cache, that expired ?Cottar
The issue comes back again after several days, I've to switch to firefox again ...Cottar
Same issue here... for now the FF alternative suffices so thanks for that. I'll try to dig a little deeper later on.Asthenosphere
F
1

I'm having the same issue. My local dev version works, but the build version runs into this error, also on Chrome. And it too works on Firefox. I'm also getting those font issues on the side too, pretty much the same besides the font origins, I don't know what's up with that.


I found the issue. For me it was this:

  const [fontLoaded, error] = useFonts({
    Inter: require('@tamagui/font-inter/otf/Inter-Medium.otf'),
    InterBold: require('@tamagui/font-inter/otf/Inter-Bold.otf'),
  });
useEffect(() => { if (error) throw error; }, [error]);

The fonts didn't actually load properly, and then in my production build this for some reason meant it would throw an error, even though it didn't in the dev build. Removing the error checking line got rid of the issue for me, maybe that'll apply to your situation too.

Fishing answered 17/4 at 5:4 Comment(3)
Good to know that someone has similar issue.Cottar
Kindly move your answer and make it a comment on the original question, as your answer doesn't include a solution. Thanks!Fimbriation
I would have done that in the first place, but I just created an account and do not have enough rep to add comments, besides this one I guess because it is on my own answer. Seeing as this stackoverflow query has no other answer, and is the only mention of this problem I can find on the entire internet in the past month, I figured I'd share my particular solution in solidarity.Fishing
A
0

In your project, are you importing FontAwesome?

Removing it from the code, makes it work on Chrome for me.

Asthenosphere answered 5/6 at 7:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.