React Native "The expo SDK requires Expo to run. .... this code is not running on Expo."
If anyone's getting this error after upgrading Expo, try restarting your simulator - that fixed it for me.
Here is my experience if someone using expo sees those error message.
I accidentally installed expo manually in my project which was version 29.0.0.
I was using version 28.0.0 of expo sdk, so it may have crashed inside.
What I did:
- manually upgrade sdkVersion of app.json to 29.0.0.
- change sdk version to 29.0.0 for react-native.
Had exactly the same error - fresh machine, fresh npm, only one version of expo installed.
Turns out, expo requires you to build it as an app before it can send it to the expo app properly (at least on Android). This is easiest done by:
- Adding an "android" section to app.json, with the contents
"package": "uk.co.yourcompany.yourpackagename"
(this is required by android packages. It can be complete garbage, but should follow that format - a backwards domain name) - running
expo build:android
and following the instructions to sign up to expo's servers and build the app - then restarting
expo start
Not sure if this is documented anywhere though, so may be a new thing?
Another thing to try is to move your node_modules
folder away (or maybe delete it, up to you) and re-run npm install