async-storage: ERROR Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

What happened?

Hi everyone,

I encountered an issue with @react-native-async-storage/async-storage. When running my React Native application, I get the following error when I run it on iOS 17.5 Simulator:

ERROR Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

I have tried all the recommended solutions but the error persists:

  1. Uninstalled the app, rebuilt, and restarted it.
  2. Cleared the Metro bundler cache using the --reset-cache flag.
  3. Ran pod install in the ios directory (using CocoaPods).
  4. Verified that @react-native-async-storage/async-storage is listed as a dependency in my package.json.
  5. Removed node_modules, yarn.lock, and package-lock.json files.
  6. Cleaned the yarn cache by running yarn cache clean.
  7. Re-installed all dependencies using yarn install and rebuilt the project.

Environment Details

  • React Native Version: “0.74.1”
  • AsyncStorage Version: “^2.1.0”
  • Platform: iOS
  • Node.js Version: v21.7.1
  • Yarn Version: 3.6.4

Expected Behavior
The app should correctly recognize the AsyncStorage NativeModule and work as expected.

Actual Behavior
The error NativeModule: AsyncStorage is null is displayed, and the app does not function correctly.


Additional Information
If there are any additional steps I could try or if there’s a known workaround, please let me know.

Thank you for your help!

Version

v2.1.0

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
  OS: macOS 15.1.1
  CPU: (14) arm64 Apple M3
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.7.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: ~/DevProject/node_modules/.bin/yarn
  npm:
    version: 10.5.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.03.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK:
    API Levels:
      - "30"
      - "31"
      - "33"
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.2
      - 34.0.0
    System Images:
      - android-30 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ATD ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.2.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

Here’s an updated issue description with the Steps to Reproduce section:


Description of the Issue

I encountered an issue with @react-native-async-storage/async-storage. When running my React Native application, I get the following error:

ERROR Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

Steps to Reproduce

  1. Create a new React Native project or use an existing one.

  2. Install @react-native-async-storage/async-storage by running:

    yarn add @react-native-async-storage/async-storage
    
  3. On iOS:

    • Navigate to the ios folder and run pod install.
    • Build and run the app using yarn run-ios.
  4. Attempt to use AsyncStorage in the app. Example:

    import AsyncStorage from '@react-native-async-storage/async-storage';
    
    const storeData = async () => {
      try {
        await AsyncStorage.setItem('key', 'value');
      } catch (e) {
        console.log(e);
      }
    };
    
    storeData();
    

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17

Most upvoted comments

@AKA-Muhannad I did but I am having same on android emulator, otherwise it is working on ios side

Hi Guys, Did anyone tried to change the simulator?

Same here, on Android “@react-native-async-storage/async-storage”: “^2.1.0” “react-native”: “0.76.4”

Downgrade to 0.76.3, and full rebuild. Need merge of: https://github.com/facebook/react-native/pull/48156