Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expo stuck on: "Welcome to Expo" screen

So I've just installed Expo SDK51: "expo": "~51.0.8", and want to build something. But I have a weird error or bug that I only see the "Welcome to Expo" large text with a prompt to create a file in "app" dir. Although this should not occus since when I look up for the text it is nowhere in the files and the app dir already has the basic tab bar files with parallax. I have never seen this occur and I have no idea how to get out of this. Yes I have tried clean run, yes I've tried restarting and so on... this is just weird.

like image 833
insider Avatar asked Sep 06 '25 15:09

insider


2 Answers

Did your project use react-native-dotenv or any other env Babel plugins? According to the Expo SDK 51 changelog:

react-native-dotenv is not compatible with expo-router. If you are using the react-native-dotenv Babel plugin, it will overwrite expo-router configuration environment variables and you'll see the empty state "Welcome to Expo" screen. We are tracking the incomptibility in expo/expo#28933, but we recommend removing the library and Babel plugin, and instead using Expo CLI's built-in support for .env files (learn more).

I had the problem when I upgraded my project from Expo SDK 49 to Expo SDK 51, so I erased module:react-native-dotenv from babel.config.js and removed the library, but it turned out I also had babel-plugin-transform-inline-environment-variables, so I had to remove that too. After refactoring to use Expo environment variables, my project worked fine.

Hope this helps :)

like image 90
teddzyb Avatar answered Sep 10 '25 03:09

teddzyb


So I had the same issue but solved it, this way following the steps below:

  • npm uninstall react-native-dotenv

  • Copy and paste the code below in your babel.config.js:

    module.exports = function (api) {
        api.cache(true);
        return {
          presets: ['babel-preset-expo']
        };
    };
    
  • Access all your environment variables like this process.env.X e.g. GOOGLE_API_KEY, make sure to use process.env.X everywhere in your application

  • Then run this command: npx expo start -c to start your expo app and it will work just fine

You can read here for more knowledge: https://docs.expo.dev/guides/environment-variables/

like image 21
Innocent Rostand MESSI II Avatar answered Sep 10 '25 01:09

Innocent Rostand MESSI II