使用世博会和@react-native-community/async-storage
using expo and @react-native-community/async-storage
我正在使用 expo
构建和捆绑我的应用程序。我添加了 @react-native-async-storage/async-storage
但我在控制台上收到以下错误:
Failed building JavaScript bundle.
Unable to resolve "@react-native-async-storage/async-storage" from "src/components/Message/Message.js"
我的设备还显示了多个可能有助于解决问题的步骤,如下所示
可惜没有解决。
我也试过:
- 从
~/.expo/
中清除 expo
缓存文件夹
- 删除并重新安装 Expo Client 应用程序
- 清除
/tmp
文件夹中的 Metro 捆绑程序缓存
我必须说,在检查 node_modules
文件夹时,我注意到该软件包安装在 @react-native-community
文件夹下,而不是 @react-native-async-storage
下 - 但我不能确定这些链接是如何在幕后神奇地发生的,但也许值得一提。
我在 @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 中看到了,但它运行正常。所以可能是我的环境中有什么东西或缺少一些配置?
有什么想法吗?
环境详情:
"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",
不要从 Message.js
文件中的 @react-native-async-storage/async-storage
导入,而是尝试导入 @react-native-community/async-storage
.
这是您安装的软件包,如您所见,它已正确安装在 node_modules
的 @react-native-community
目录下。
-import AsyncStorage from '@react-native-async-storage/async-storage';
+import AsyncStorage from '@react-native-community/async-storage';
如果您 运行 展览会使用:
expo start --dev-client
您可能需要重建您的开发客户端。
如果您 运行 使用 Expo GO,它将自动链接:
expo start
我正在使用 expo
构建和捆绑我的应用程序。我添加了 @react-native-async-storage/async-storage
但我在控制台上收到以下错误:
Failed building JavaScript bundle.
Unable to resolve "@react-native-async-storage/async-storage" from "src/components/Message/Message.js"
我的设备还显示了多个可能有助于解决问题的步骤,如下所示
可惜没有解决。 我也试过:
- 从
~/.expo/
中清除 - 删除并重新安装 Expo Client 应用程序
- 清除
/tmp
文件夹中的 Metro 捆绑程序缓存
expo
缓存文件夹
我必须说,在检查 node_modules
文件夹时,我注意到该软件包安装在 @react-native-community
文件夹下,而不是 @react-native-async-storage
下 - 但我不能确定这些链接是如何在幕后神奇地发生的,但也许值得一提。
我在 @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 中看到了,但它运行正常。所以可能是我的环境中有什么东西或缺少一些配置?
有什么想法吗?
环境详情:
"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",
不要从 Message.js
文件中的 @react-native-async-storage/async-storage
导入,而是尝试导入 @react-native-community/async-storage
.
这是您安装的软件包,如您所见,它已正确安装在 node_modules
的 @react-native-community
目录下。
-import AsyncStorage from '@react-native-async-storage/async-storage';
+import AsyncStorage from '@react-native-community/async-storage';
如果您 运行 展览会使用:
expo start --dev-client
您可能需要重建您的开发客户端。
如果您 运行 使用 Expo GO,它将自动链接:
expo start