import Expo from 'expo' has been deprecated

Hi, after upgrade to sdkVersion 31 i’ve this yellow warning in console:

The syntax “import Expo from ‘expo’” has been deprecated in favor of “import { A, B, C } from ‘expo’” or “import * as Expo from ‘expo’”. This sets us up to support static analysis tools like TypeScript and dead-import elimination better in the future. The deprecated import syntax will be removed in SDK 32.

  • node_modules/expo/build/environment/logging.js:25:23 in warn
  • node_modules/expo/build/Expo.js:691:4 in get
  • node_modules/react-native-scripts/build/bin/crna-entry.js:23:7 in <unknown>
  • node_modules/metro/src/lib/polyfills/require.js:292:12 in loadModuleImplementation
  • node_modules/metro/src/lib/polyfills/require.js:179:45 in guardedLoadModule
  • null:null in global code

Where i’ve to fix import code?
After upgrade app i’ve remove node_modules folder and run npm install.



Hey @shork,

I would recommend using your IDE’s find in project/buffer to see where there is a import Expo from 'expo' call and then change it to one of the newer valid syntax options.



Hi adamjnav,
I searched with Atom throughout the project but I only found it only in comments and in node_modules/react-native-scripts/build/bin/ file


I am having the exact same problem with @shork. I’ve also searched through the code to find for instances of

import Expo from 'expo' but there is none


Can confirm. I have no instances of import Expo from ‘expo’ anywhere in my app.
Still get the warning.

1 Like

I perhaps should have clarified a bit. Importing Expo as a whole is deprecated so searching for import Expo from 'expo explicitly may not yield any results, but you may still have an import statement such as import Expo, {AppLoading, Font} from 'expo. Can you check for any import statements that include Expo?

It looks like the issue has to do with node_modules/react-native-scripts/build/bin/crna-entry.js. Expo CLI no longer depends on react-native-scripts. The simplest thing I think is to use the modern Expo entry point and modify your package.json to have:

  "main": "node_modules/expo/AppEntry.js",

This solved the problem for me!
Thanks @ide

me too!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.