How to fix react-native error after updating expo to 50.0
Asked Answered
I

5

13

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

Indulgence answered 23/1 at 23:46 Comment(1)
I got below solution in expo blog, but it still does not solve the problem Remove the expo-router/babel preset in favor of babel-preset-expo and be sure to clear the Metro cache before restarting your dev server—this means running npx expo start --clear or npx expo export --clearIndulgence
I
35

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

Indulgence answered 24/1 at 0:35 Comment(1)
To add on to this, I also had to remove the "Plugins" property for it to work in that file.Undermine
R
7

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
Ronnyronsard answered 26/1 at 7:14 Comment(0)
S
6

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

npx expo start --clear
Sabaean answered 24/1 at 6:3 Comment(0)
C
2

if after you remove the expo-router/babel from the babel.config.js plugins and you still get an error saying you should remove the expo-router/babel again

Do this

  • Just run npx expo start --clear
Conceal answered 16/6 at 12:49 Comment(0)
H
0
  1. Removed the expo-router/babel from babel.config.js file.
  2. Run npx expo start --clear

It will work

Hamartia answered 13/7 at 9:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.