Cannot import firebase: AsyncStorage is null

Hello there!

I’m trying to build my first iOS app with expo, and I was following this guide to integrate firebase into it when I ran into this issue:

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

The solutions in the github issue doesn’t seem to work well with expo, does anybody know how to fix this?

thanks!

Hi
I am facing exactly the same issue.

I installed Firebase

npm i --save firebase

then I had an error saying “Unable to resolve react-native-community/async-storage”. So I installed that module

npm install @react-native-community/async-storage --save

So now I am facing that problem
NativeModule: AsyncStorage is null

I already run “react-native link” but the message keeps appearing

Hey all,

This sounds like it may be an issue with the Firebase JS SDK and it looks like a couple issues have already been created about this. Also, running react-native link won’t work in a Managed Expo app.

Cheers,
Adam

1 Like

Hi

Good news here

I solved this problem. The reason of this error? I dont have an accurate answer, but this is what I have done:

I created a new React-Native project from scratch using Expo.
Installed Firebase (npm i firebase)
Run the project and it worked without any error.

My main project is almost new as well though, so I tried to see the differences between both but they don’t have in fact many differences.

Well, long story short…

Finally I took all the files from my original project (except for node_modules) and put in a different folder with another name. Then it works. Moving file to another folder or changing the name of the original folder works.
My theory is that there is some kind of conflict with Git (Bitbucket in my case)… because even if I try to create a React-Native project from scratch inside my original project folder (an empty folder), it throws the same asyncStorage = null error when installing firebase.

Solution:
So… I created a new Bitbucket project, and moved my old files to this new repository. Otherwise you change the name of the root folder to any name. Changing the repository worked for me, and keeping the same root folder name worked for me.

I hope this solves your problem @martriay

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.