How can I set up an Expo app to work behind a corporate proxy? - react-native

I want to try to React Native / Expo App on my company PC (Windows).
I was following all guides on Proxy setup and settings, but I'm still getting this error.
Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
I've added proxies to .npmrc file, also tried changing URL Server by this command_
export EXPO_PACKAGER_PROXY_URL=http://expo.dev npx expo start
Tried to set up tunneling, but unsuccessfully.
Has anyone encountered similar problems and found solution to it.
Thanks in advance

I deal with this same issue at work. I have discovered a few work-arounds through trial and error.
use yarn to import expo modules. This seems to help with the dependency issues that expo imports often have.
set yarn config to yarn config set strict-ssl false -g if you are receiving SSL errors.
run this command - $Env:NODE_TLS_REJECT_UNAUTHORIZED=0 if you are receiving SELF_SIGNED_CERT_IN_CHAIN errors. <--this is not 100% safe because makes TLS connections and HTTPS requests insecure by disabling certificate verification -- use at your own risk.
The Unable to reach Expo servers... error still renders, but I can just ignore it and continue.

Related

Expo modules core dependency.platformns.ios must be of type object

I just updated to Expo 43.0 in a bare workflow project and followed the guide on how to update the app to also use expo-modules-core. The app runs in dev mode and can compile to both Android and iOS. However, when running react-native-start the following message is shown in the terminal:
warn Package expo-modules-core has been ignored because it contains invalid configuration. Reason: "dependency.platforms.ios" must be of type object
Then the metro server starts. I have tried searching for others with similar issues, does anyone know what may be causing this?
I followed this guide: https://docs.expo.dev/bare/installing-expo-modules/
This warning is coming from react-native-community autolinking. it looks like the api changed and they don't accept null values anymore, but this is what they still specify in their docs. the behavior you see is expected still - expo-modules-core is and should be ignored by react-native-community autolinking, because it's handled by expo autolinking. so, this won't impact your project and it's a warning caused either by an accidental regression or undocumented change in react-native-community autolinking.
https://github.com/expo/expo/issues/16085
Yes, it is coming from react-native. So for resolving this issue you have to remove the react-native.config.js file from node_modules
Follow the bellow steps:-
Go to node_modules/expo-modules-core
Delete react-native.config.js

What is the Difference between running react native code on Web Browser and Expo GO?

I am running React Native Code on the Web browser and in Expo Go. In the web browser, it runs fine without any error but in Expo Go, it is not importing even a single module and showing module not found error again and again on almost all modules even after reinstalling them and also reinstalling node_modules.
Can anyone tell what's the difference between running react-native code on Expo Go and Web Browser?
Also what is this issue and how to solve it?

Sockets not working in release build React Native

I'm working on a project where I require sockets. So I implemented a socket connection and was working on debug but not in release build.
I need to get sockets working on release build without using socket.io.
I'm using React Native : 0.61.5
And internet permission is mentioned in manifest file.
Please help.
As mentioned on Github: https://github.com/facebook/react-native/issues/24361
Make sure your config.urlServer is not an HTTP endpoint but should be HTTPS. Latest RN versions target recent Android SDK that blocks insecure HTTP connections automatically
If anyone is facing the same issue, because of the "http" just add android:usesCleartextTraffic="true" in tag in android\app\src\main\AndroidManifest.xml
and you should be good.

Can't run expo error: getaddrinfo ENOTFOUND exp.host

this error appear suddenly after updating expo-cli to version 3.2.3
I can't manage to run the application, it displays error like this when I run expo start / yarn start
Trying to open the project in iOS simulator...
Opening exp://127.0.0.1:19000 in iOS simulator
Expo Press ? to show a list of all available commands.
Fetching the user profile failed
getaddrinfo ENOTFOUND exp.host
even I open expo.host from the browser loading.. I tried using 2 internet providers, change dns, flush dns, etc. still not loaded.
I solved this by deleting all expo related files and folders in my project
.expo and .expo-shared specifically.
when you run expo start, expo will automatically regenerate those files.
Make sure you are connected to the same network as your phone and PC,
you can try signing in and starting the project from your recent development tab on expo client.
if this dosen't work try reomving some devDependencies that you're not really using, then delete the node modules and install afresh.
I was facing the similar issue. It got resolved, as I logged in to the expo in my project folder.
Using expo w, you can check if you are logged-in in expo. and use expo login command to login

React-Native run-android basic Getting Java.Net.UnknownHostException

I am a beginner in React Native and i have followed all the steps carefully as suggested in react-native Get-Started. Once the project is initiated and i try to run the same using run-android command, I am getting "java.net.UnknownhostException". To be particular, this issue is happening during gradle(https://services.gradle.org/distributions/gradle-2.2.1-all.zip) download.
I am on a corporate network and I have done the proxy setup as well in gradle-home/properties. I have tried downloading the gradle file manually and it works fine in my browser.
Any leads in fixing this issue is highly appreciated.
I think this link can solve your problem:
https://github.com/facebook/react-native/issues/2726
Edit gradle.properties in android sub-folder with the following details:
systemProp.http.proxyHost=proxyHost
systemProp.http.proxyPort=proxyPort
systemProp.https.proxyHost=proxyHost
systemProp.https.proxyPort=proxyPort
systemProp.http.proxyUser=YOUR_USERNAME
systemProp.http.proxyPassword=YOUR_PASSWORD
systemProp.https.proxyUser=YOUR_USERNAME
systemProp.https.proxyPassword=YOUR_PASSWORD