Closed IncrediblePony closed 1 year ago
I have cleared every imaginable cache known to man. Deleted all old build files, and thrown away yarn.lock
files and node_modules
Well... I 'fixed' the issue be removing expo... So there's that..
Fixed this by replacing
const { getDefaultConfig } = require("@react-native/metro-config");
with
const { getDefaultConfig } = require("expo/metro-config");
in metro.config.js.
@SpadarShut after change, are you need re-run metro server or anything?
@pqv2210 you need to have expo/metro-config installed obviously, and yes, restart metro.
I"m still seeing this issue, after upgrading to 0.72.4. I've always had const { getDefaultConfig } = require("expo/metro-config")
so seems like there may be another cause
I'm using Expo with prebuild to generate my react-native app. I ran into this while upgrading from Expo 48 to Expo 51.
For ios --
It looks like that process had updated the ios/App/AppDelegate.mm
file
to replace "index" with ".expo/.virtual-metro-entry" in the following code block:
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
Update to this:
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
For android --
In android/app/src/main/java/path/to/application/MainApplication.kt
Replace
override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
With
override fun getJSMainModuleName(): String = "index"
This defeats the purpose of prebuild as I'm updating native files. But I just wanted to get past this problem as I couldn't find another solution. Hopefully this may help you.
I'm not sure whether you are using Expo for more than just the metro config. Here appears to be relevant PR for future research.
I'm using Expo with prebuild to generate my react-native app. I ran into this while upgrading from Expo 48 to Expo 51.
For ios -- It looks like that process had updated the
ios/App/AppDelegate.mm
file to replace "index" with ".expo/.virtual-metro-entry" in the following code block:#if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif
Update to this:
#if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif
For android -- In
android/app/src/main/java/path/to/application/MainApplication.kt
Replace
override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
With
override fun getJSMainModuleName(): String = "index"
This defeats the purpose of prebuild as I'm updating native files. But I just wanted to get past this problem as I couldn't find another solution. Hopefully this may help you.
I'm not sure whether you are using Expo for more than just the metro config. Here appears to be relevant PR for future research.
Thank you! This worked!
Just remove metro-config.js and that's it. If you need it add this one instead.
const{ getDefaultConfig } = require("expo/metro-config") in metro.config.js
Environment
Things I’ve done to figure out my issue
Upgrading version
0.72.4
Description
I've tried to follow the guidance of the react native upgrade helper web tool. I've gotten to the point where every package is installed. The application builds successfully. I've upgraded my java version from 11 to 17. I've done all of the configs and modifications I have been instructed to do, but now a wall has been hit. When I reach the step of getting my application to bundle I get the following error:
I am not sure how to go about this. I have tried to create an empty
json
file in the.expo
folder called.virtual-metro-entry.json
and making it executable. But that doesn't fix the problem and I expect it to be a problem with my upgrade not taking metro/expo into account.Pastebin of package.json Pastebin of .bashrc PATH setup