Reputation: 2044
I'm using expo
to build and bundle my app. I've added @react-native-async-storage/async-storage
but I get the following error on console:
Failed building JavaScript bundle.
Unable to resolve "@react-native-async-storage/async-storage" from "src/components/Message/Message.js"
my device also show multiple steps that might help to solve it as can be seen here
but unfortunately it didn't solve it. I also tried:
expo
cache folder from ~/.expo/
/tmp
folderI must say that when checking the node_modules
folder, I've noticed that the package is installed under @react-native-community
folder and not under @react-native-async-storage
- but I can't be sure how those links magically happening under the hood, but maybe it worth to mention.
I saw in @react-native-async-storage/async-storage
docs that I need to run another pod install
command but In expo
the platform-specific folder is not accisible and the command runs without doing anything. Moreover, I've conducted expo snack
example but it functions properly. So probably something in my env or missing some configuration?
Any ideas?
Env details:
"expo": "^38.0.0",
"expo-cli": "3.27.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"@react-native-community/async-storage": "~1.11.0",
Upvotes: 4
Views: 7922
Reputation: 3378
If you're running expo using:
expo start --dev-client
You likely need to rebuild your dev client.
If you're running using Expo GO it'll be linked automatically:
expo start
Upvotes: 0
Reputation: 471
Instead of importing from @react-native-async-storage/async-storage
in your Message.js
file try importing @react-native-community/async-storage
.
This is the package you've installed, it was correctly installed under @react-native-community
directory in node_modules
as you noticed.
-import AsyncStorage from '@react-native-async-storage/async-storage';
+import AsyncStorage from '@react-native-community/async-storage';
Upvotes: 1