How to fix react-native error after updating expo to 50.0

7.6k Views Asked by At

When I run npm run ios in terminal, I get the below error

error: node_modules/expo-router/entry.js: [BABEL]: expo-router/babel is deprecated in favor of babel-preset-expo in SDK 50

I tried to install babel-preset-expo, but it was already installed

3

There are 3 best solutions below

1
Elvin Shahsuvarli On BEST ANSWER

Removed the expo-router/babel from babel.config.js file and it works.

0
bo_ On

Removed the expo-router/babel from babel.config.js and re-run your expo app/server, clearing your cache with:

npx expo start --clear
0
Tribunal Loral On

I tried the above answers and didnt work. This is how I have done it.

The Error actually says to use babel-preset-expo instead. So

run this:

npm install --save-dev babel-preset-expo

update the babel.config.js

    module.exports = function(api) {
      api.cache(true);
    
      const presets = ['babel-preset-expo'];
    
      return {
        presets,
      };
};

then clear cache:

npx expo start --clear