reactnative / reactnative.com

Use React Native to build native iOS and Android apps with JS
http://www.reactnative.com/
11 stars 3 forks source link

ERROR ReferenceError: Can't find variable: r #2

Closed abhsax130778 closed 3 years ago

abhsax130778 commented 3 years ago

Whenever I run my React Native project (after removing node_modules, .gradle, .idea, android/app/build, android/build) I get the following error in my metro server:

info Reloading app...
[Fri Jun 11 2021 14:46:49.120]  BUNDLE  ./index.js 

[Fri Jun 11 2021 14:46:50.778]  ERROR    ReferenceError: Can't find variable: r
[Fri Jun 11 2021 14:46:50.780]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
[Fri Jun 11 2021 14:46:50.782]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

exported = true is in all my activity entries in manifest:

<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" 
      android:exported="true"/>

This is my package.json:

{
  "name": "HeraMedica",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start --reset-cache",
    "test": "jest",
    "lint": "eslint .",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.15.4",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/datetimepicker": "^2.6.2",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^6.0.0",
    "@react-native-google-signin/google-signin": "^6.0.0",
    "@react-native-picker/picker": "^1.15.0",
    "@react-navigation/drawer": "^5.12.5",
    "@react-navigation/material-top-tabs": "^5.3.15",
    "@react-navigation/native": "^5.9.3",
    "@react-navigation/stack": "^5.14.3",
    "moment": "^2.29.1",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-crypto-js": "^1.0.0",
    "react-native-fbsdk": "^3.0.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-keyboard-aware-scroll-view": "^0.9.4",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^2.1.0",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-material-textfield": "^0.16.1",
    "react-native-modal-datetime-picker": "^9.2.3",
    "react-native-pager-view": "^5.1.10",
    "react-native-picker-select": "^8.0.4",
    "react-native-reanimated": "^2.1.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^2.18.1",
    "react-native-switch": "^2.0.0",
    "react-native-tab-view": "^3.0.1",
    "react-native-table-component": "^1.2.1",
    "react-redux": "^7.2.2",
    "redux": "^4.0.5",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

I don't have a clue where this error is coming from.

UPDATE:

When I am in another branch of the same repository using same package.json configuration, I am getting other errors:

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:592:3)
    at tryReadSync (fs.js:366:20)
    at Object.readFileSync (fs.js:403:19)
    at UnableToResolveError.buildCodeFrameMessage (/Users/lion/Documents/Companies/Flex_project/TeleMedicine/React/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:304:17)
    at new UnableToResolveError (/Users/lion/Documents/Companies/Flex_project/TeleMedicine/React/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:290:35)
    at ModuleResolver.resolveDependency (/Users/lion/Documents/Companies/Flex_project/TeleMedicine/React/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:168:15)
    at DependencyGraph.resolveDependency (/Users/lion/Documents/Companies/Flex_project/TeleMedicine/React/node_modules/metro/src/node-haste/DependencyGraph.js:353:43)
    at /Users/lion/Documents/Companies/Flex_project/TeleMedicine/React/node_modules/metro/src/lib/transformHelpers.js:271:42
    at Server.<anonymous> (/Users/lion/Documents/Companies/Flex_project/TeleMedicine/React/node_modules/metro/src/Server.js:842:41)
    at Generator.next (<anonymous>)
abhsax130778 commented 3 years ago

I would like to see other updates of mine at: https://stackoverflow.com/questions/67938327/error-referenceerror-cant-find-variable-r

abhsax130778 commented 3 years ago

I could locate where this 'r' is: https://imgur.com/a/1TOTS1q But there are other errors.