- SDK Version: 43.0.2
- Platforms(Android/iOS/web/all): web/iOS
I was working in the iOS simulator, my project was working fine. I accidentally clicked “Run in web browser” inside my Metro Bundler browser window.
The below error appeared
TypeError: undefined is not an object (evaluating 'navigator.userAgent.length')
- ... 9 more stack frames from framework internals
Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
Then I ran
$ rm -rf .expo .expo-shared yarn.lock node_modules
$ yarn start
The package.json name and the app.json name are the same.
Still the error is persisting.
Could it be something to do with AppEntry.js or AppRegistry.js?
I am interested in eventually supporting a web browser client of my app.
Package.json:
{
"name": "appname",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"dependencies": {
"@apollo/client": "^3.5.5",
"@bugsnag/expo": "^7.15.1",
"@expo/vector-icons": "^12.0.0",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-navigation/bottom-tabs": "^6.0.5",
"@react-navigation/native": "^6.0.2",
"@react-navigation/native-stack": "^6.1.0",
"@splitsoftware/splitio": "^10.17.1",
"apollo3-cache-persist": "^0.13.0",
"cross-fetch": "^3.1.4",
"expo": "~43.0.2",
"expo-analytics-segment": "~11.0.3",
"expo-asset": "~8.4.3",
"expo-constants": "~12.1.3",
"expo-facebook": "~12.0.3",
"expo-firebase-recaptcha": "^2.1.0",
"expo-font": "~10.0.3",
"expo-linking": "~2.4.2",
"expo-localization": "~11.0.0",
"expo-modules-core": "~0.4.10",
"expo-notifications": "~0.13.3",
"expo-splash-screen": "~0.13.5",
"expo-status-bar": "~1.1.0",
"expo-updates": "~0.10.15",
"expo-web-browser": "~10.0.3",
"firebase": "9.5.0",
"graphql": "^16.0.1",
"i18n-js": "^3.8.0",
"jest-fetch-mock": "^3.0.3",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-country-picker-modal": "^2.0.0",
"react-native-gesture-handler": "^2.2.0",
"react-native-reanimated": "^2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.8.0",
"react-native-web": "0.17.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-native": "^9.0.0",
"@types/country-select-js": "^1.0.2",
"@types/enzyme": "^3.10.11",
"@types/i18n-js": "^3.8.2",
"@types/jest": "^27.4.0",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"@types/react-test-renderer": "^17.0.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint-config-airbnb": "^19.0.4",
"jest": "^27.4.7",
"jest-expo": "~43.0.0",
"react-test-renderer": "17",
"ts-jest": "^27.1.3",
"ts-node": "^10.4.0",
"typescript": "~4.3.5"
},
"private": true
}