Closed bananer closed 3 months ago
Workaround of course is to delete repo/app/node_modules/@react-native-async-storage/
every time before building the Android app.
Another workaround is to downgrade to 1.19.8
After spending quite some time trying to get to the bottom of this, it seems like what actually caused this file to appear was VSCode with the Java plugin running with repo/node_modules/@react-native-async-storage/async-storage
directory open. :facepalm:
What happened?
In our monorepo setup (npm workspaces) all dependencies are hoisted into
repo/node_modules
. We have async-storage declared as dependencies inrepo/lib/package.json
andrepo/app/package.json
.When running
npm istall
, async-storage is placed as expected inrepo/node_modules/@react-native-async-storage/async-storage
.When building and running the Android version of
repo/app
, the filerepo/app/node_modules/@react-native-async-storage/async-storage/android/.project
and its parent directories are created. Its content looks like this:Because of this directory existing, the next time the app is built, React Native does not include the async-storage native module from the hoisted
node_modules
and the app fails to start with errorrTypeError: Cannot read property 'asyncStore' of undefined
andError: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
Version
1.22.3
What platforms are you seeing this issue on?
System Information
Steps to Reproduce
@react-native-async-storage/async-storage