问题描述
I've been looking for a solution to this problem for a couple of days now and I think it has something to do with my upgrade to the latest version of expo. I've tried downgrading the SDK and expo version, deleting my node_modules and package-lock and reinstalling. I've added in SourceExts to my app.json.
Any help would be appreciated. The app works in the web browser but won't build for iOs or android simulators.
app.json
{
"expo": {
"name": "GotThis",
"slug": "GotThis",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"web": {
"favicon": "./assets/favicon.png"
},
"packagerOpts": {
"sourceExts": ["js", "json", "ts", "tsx", "jsx"]
}
}
}
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"test": "jest",
"eject": "expo eject"
},
"dependencies": {
"expo": "~38.0.8",
"expo-status-bar": "^1.0.2",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"react-native-elements": "^2.0.4",
"react-native-paper": "^4.0.1",
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "^7.10.5",
"babel-preset-expo": "^8.1.0",
"jest-expo": "^38.0.2",
"metro": "^0.60.0",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "^16.13.1"
},
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)"
]
},
"private": true
}
node_modules/expo/AppEntry.js
import registerRootComponent from 'expo/build/launch/registerRootComponent';
import App from '../../App';
registerRootComponent(App);
Error in the android emulator android error
解决方案npm ls metro-config
In my case, I changed my version of the metro
from 0.65.0
to 0.56.4
and fixed the issue. ubuntu here.