After upgrading from Expo SDK 49 to Expo SDK 50 I'm now getting this error while trying to load my project on a simulator:
Metro has encountered an error: While trying to resolve module react from file 'App.tsx', the package 'node_modules/@types/react/package.json' was successfully found. However this package itself specifies a 'main' module field that could not be resolved 'node_modules/@types/react/index'. Indeed, none of these files exist:
I've tried looking into the issue, but none of the fixes I've found has seemed to work. Here's my package.json:
{
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --config ./jest.config.json --outputFile test-results.json --json"
},
"dependencies": {
"@babel/preset-env": "^7.16.11",
"@expo-google-fonts/nunito": "^0.2.0",
"@expo/react-native-action-sheet": "^3.12.0",
"@pstyczynski/react-native-expo-pdfjs": "^1.0.0",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-native-community/datetimepicker": "7.6.1",
"@react-native-firebase/analytics": "^18.7.3",
"@react-native-firebase/app": "^18.7.3",
"@react-native-picker/picker": "2.6.1",
"@react-navigation/bottom-tabs": "^6.0.9",
"@react-navigation/native": "^6.0.6",
"@react-navigation/native-stack": "^6.2.5",
"@react-navigation/stack": "^6.0.11",
"@reduxjs/toolkit": "^1.9.5",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-hooks": "^8.0.0",
"@testing-library/react-native": "^9.1.0",
"@types/react-native-base64": "^0.2.0",
"@types/react-native-loading-spinner-overlay": "^0.5.3",
"@types/react-native-vector-icons": "^6.4.18",
"@types/styled-components-react-native": "^5.1.3",
"axios": "^0.24.0",
"axios-hooks": "^5.0.2",
"axios-mock-adapter": "^1.20.0",
"babel-jest": "^27.5.1",
"base-64": "^1.0.0",
"expo": "^50.0.0",
"expo-build-properties": "~0.11.1",
"expo-checkbox": "~2.7.0",
"expo-clipboard": "~5.0.1",
"expo-constants": "~15.4.5",
"expo-dev-client": "~3.3.9",
"expo-device": "~5.9.3",
"expo-document-picker": "~11.10.1",
"expo-font": "~11.10.3",
"expo-image-picker": "~14.7.1",
"expo-linear-gradient": "~12.7.2",
"expo-linking": "~6.2.2",
"expo-local-authentication": "~13.8.0",
"expo-print": "~12.8.1",
"expo-secure-store": "~12.8.1",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-store-review": "~6.8.3",
"expo-system-ui": "~2.9.3",
"expo-updates": "~0.24.11",
"fbjs": "^3.0.4",
"formik": "^2.2.9",
"jest": "^29.2.1",
"jest-mock-extended": "^2.0.4",
"jest-styled-components": "^7.1.1",
"jetifier": "^2.0.0",
"moment": "^2.29.1",
"moti": "^0.17.1",
"qs-stringify": "^1.2.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.73.4",
"react-native-blob-util": "^0.14.1",
"react-native-btr": "^2.2.0",
"react-native-device-info": "^8.7.0",
"react-native-document-picker": "^8.0.0",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.14.0",
"react-native-hr-component": "^2.0.3",
"react-native-image-picker": "^4.7.3",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-loading-spinner-overlay": "^2.0.0",
"react-native-masked-text": "^1.13.0",
"react-native-modal": "13.0.1",
"react-native-modal-datetime-picker": "^14.0.0",
"react-native-pager-view": "6.2.3",
"react-native-paper": "^4.11.1",
"react-native-pdf": "^6.4.0",
"react-native-picker-select": "^8.0.4",
"react-native-radio-buttons-group": "^2.2.7",
"react-native-reanimated": "~3.6.2",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-share": "^7.3.6",
"react-native-svg": "14.1.0",
"react-native-tab-view": "^3.1.1",
"react-native-use-modal-hooks": "^1.3.0",
"react-native-vector-icons": "^10.0.3",
"react-native-web": "~0.19.6",
"react-native-webview": "13.6.4",
"react-redux": "^7.2.6",
"redux-persist": "^6.0.0",
"styled-components": "^5.3.3",
"yup": "^0.32.11"
},
"devDependencies": {
"@babel/core": "^7.19.3",
"@babel/plugin-transform-flow-strip-types": "^7.23.3",
"@types/react": "~18.2.14",
"jest-expo": "~50.0.3",
"react-test-renderer": "^18.2.0",
"typescript": "^5.1.3"
},
"resolutions": {
"@types/react": "18.2.0",
"@types/react-dom": "18.2.0"
},
"jest": {
"preset": "jest-expo"
},
"private": true,
"name": "Project",
"version": "1.0.1"
}