3

I'm trying to remove react-native-device-info from our React Native project (in favor of the smaller react-native-version-number).

I've taken these steps:

  1. yarn remove react-native-device-info
  2. cd ios && pod install
  3. Clean build and clear watchman/packager cache
  4. Delete and recreate the JS bundle
  5. grep for any references to react-native-device-info in entire project directory including node-modules (none found)

However, when I run the app I still get these errors. What am I missing?

[Thu Jul 23 2020 14:20:30.622]  ERROR    Error: @react-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null. To fix this issue try these steps:
  • For react-native <= 0.59: Run `react-native link react-native-device-info` in the project root.
  • Rebuild and re-run the app.
  • If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
  If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-device-info
[Thu Jul 23 2020 14:20:30.623]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
[Thu Jul 23 2020 14:20:31.746]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

enter image description here

Freewalker
  • 6,329
  • 4
  • 51
  • 70

2 Answers2

3

In the current version of react-native, just removing the dependency from package.json and running pod install should work. No manual unlinking is necessary.

We added a yarn postinstall script in package.json as well to always run pod install:

"postinstall": "(cd ios && pod install)",

Freewalker
  • 6,329
  • 4
  • 51
  • 70
1

react-native unlink react-native-device-info

You need to remove react-native-device-info from your codebase as well, you probably still import it in some file. Also when removing pods remember to reinstall the app and restart the bundler.

  • 1
    And as a last alternative restart your computer hahahah – Gabriel Donadel Dall'Agnol Jul 23 '20 at 20:42
  • 1
    Actually just restarting everything may have done it. It was working when I started this morning. A bit bizarrre. Also noted that some code I added was not picked up (console.log) not working so that's another clue on what was going on. – Freewalker Jul 24 '20 at 15:22
  • 1
    That might be related to `.git/index.lock` file then, it happened to me in the past, nothing in my code was updating. Maybe this can help you https://stackoverflow.com/questions/9282632/git-index-lock-file-exists-when-i-try-to-commit-but-cannot-delete-the-file/39860852 – Gabriel Donadel Dall'Agnol Jul 24 '20 at 15:37