问题中的错误信息:
在尝试从文件C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\@firebase\app\dist\esm\index.esm2017.js
解析模块idb
时,成功找到了包C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\idb\package.json
。然而,此包本身指定了一个无法解析的main
模块字段(C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\idb\build\index.cjs
)。实际上,这些文件都不存在:
这个错误让人困惑的部分是,在目录中的确存在文件index.esm2017
:'`C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\idb\build\index.cjs'
我已经卸载和重新安装了firebase。我已经安装和卸载了'idb'。我已经清除了yarn缓存、expo缓存、删除了node_modules并重新安装了它们,以及清除了watchman缓存,但都没有用。我还三次确认了文件目录的确在错误消息所说的位置。
当安装lottie-react-native时出现了错误,但似乎与之无关。即使删除lottie-react-native,问题仍然存在。我使用git将代码还原到行为开始之前,但问题仍然存在。
整个项目似乎已经毁了,该如何继续进行。
.cjs
文件扩展名,这在 Expo 或 React Native 中默认不支持。因此,我们需要手动配置metro.config
来解析它。请在此阅读详细信息。 - Sohel Islam Imrannode_modules
才最终使其工作。 - geg