We are getting this error when running some tests:
The Expo SDK requires Expo to run. It appears the native Expo modules are unavailable and this code is not running on Expo. Visit https://docs.expo.io to learn more about developing an Expo project.
In expo/src/environment/validate there is this check:
if (!Constants || !Constants.expoVersion) {
throw new Error(
`The Expo SDK requires Expo to run. It appears the native Expo modules are unavailable and this code is not running on Expo. Visit https://docs.expo.io to learn more about developing an Expo project.`
);
}
How can we overcome this when running tests with Jest?
Am getting same error but not because of tests. I just created a pure blank new expo project and when I try running it’s giving this same error. I noticed this error is only in sdk version 29 cause I used previous versions (28) and everything is working fine. Please how can I fix this?
breaks the jest-expo setup.
It’s a bit of a catch 22 because we want to mock react native and also we have a few components that import from Expo.
We can mock the code that imports from expo for now but this is not very optimal …
Any ideas?
/Stephen
I had this same problem earlier because I upgraded my expo version from 27 to 29. To fix, check your app.json file and make sure that the sdkVersion key says 29.0.0.
Same problem. I am not running tests or something else.
Just start a new project via XDE, everything goes fine until bundling finished and this error shows up.
Any solutions yet?
Same here: ejected our project (sdk30) → pod install, build successful, but when running the app, even if I see in the expo server logs that the app connects (“Finished building JavaScript bundle in 3340ms.”) I have this “The Expo SDK requires Expo to run” error.
I also tried to create a fresh new project (“expo init” - sdk30), eject, build → same error