【发布时间】:2022-02-12 01:13:04
【问题描述】:
我正在使用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 bundler缓存
我必须说,在检查 node_modules 文件夹时,我注意到该软件包安装在 @react-native-community 文件夹下而不是 @react-native-async-storage 下 - 但我不能确定这些链接是如何神奇地发生在引擎盖,但也许值得一提。
我在@react-native-async-storage/async-storage docs 中看到我需要运行另一个pod install 命令,但在expo 中,platform-specific 文件夹不可行,并且该命令运行时不执行任何操作。此外,我已经进行了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",
【问题讨论】:
-
您是否尝试过使用
--clear选项启动打包程序?根据expo start --help,它清除 Metro 捆绑器缓存。也许 Metro 在更多地方有缓存,而不仅仅是/tmp? ?????? -
@StanisławChmiela 没有帮助:(
-
清除缓存
expo r -c
标签: javascript react-native expo asyncstorage