Reputation: 21
Previously, my project was running on Expo SDK 49. Today, I updated it to SDK 51. However, upon running the expo project with the command npx expo start
, I encountered the following errors:
Android Bundled 11242ms D:\Projects\Booking\node_modules\expo\AppEntry.js (1661 modules)
ERROR TypeError: Cannot read property 'style' of undefined, js engine: hermes
ERROR Invariant Violation: "main" has not been registered. This can happen if:
AppRegistry.registerComponent
wasn't called., js engine: hermes.I'm attempting to run the app so I can proceed with my work, but I keep encountering these errors, and none of the solutions seem to be effective.
Upvotes: 2
Views: 3252
Reputation: 81
Currently upgrading from SDK49 to SDK51 requires a major change in how the app is bundling your code and displaying it. Previously Expo used Webpack but now instead is using Expo Router. The traditional "expo/webpack-config.js" has been deprecated as of SDK51 so you no longer use "main": "node_modules/expo/AppEntry.js"
in package.json and instead it needs to be "main": "expo-router/entry"
as well as a whole lot of other changes.
You can read more about Expo Router here: https://docs.expo.dev/router/introduction/
Here is documentation on how to migrate: https://docs.expo.dev/router/migrate/from-expo-webpack
Note that this error ERROR in ./node_modules/expo-modules-core/build/uuid/uuid.web.js:9:8 Module not found: Can't resolve 'crypto'
is happening when running npx expo start
in SDK51.
(more details here: https://github.com/expo/expo/issues/26706#issuecomment-1911213867)
Therefore I do not suggest upgrading to SDK51 yet. However it is good to note that the way Expo Router navigation works is vastly different from @react-navigation. More details for that can be found in the above links.
Upvotes: 0
Reputation: 119
I'm not sure how you upgrade but basically expo suggest that when upgrading,upgrade one Sdk at the time . expo doc:"We recommend upgrading SDK versions incrementally, one at a time. Doing so will help you pinpoint breakages and issues that arise during the upgrade process."
https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/
Upvotes: 0