【发布时间】:2022-11-09 00:44:13
【问题描述】:
我想用 React Native 创建一个移动应用程序。我正在使用 Expo,我想使用 Realm Sync 作为我的数据库。
信息:
- 我正在处理 vs 代码(在 mac 上)
- Node.js 版本:16.18.0
- 反应版本:18.2.0
- React 原生版本:0.69.6
- npm 8.19.0
问题: 我们已经安装了 Expo 44 版本(因为更高版本或更早版本的 Expo 与 Realm 不匹配),但仍然无法安装 Realm Sync。当我跑 “npm install realm”,我收到以下错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: realm@11.0.0
npm ERR! Found: react-native@0.69.6
npm ERR! node_modules/react-native
npm ERR! peer react-native@"*" from @react-native-community/cli@8.0.6
npm ERR! node_modules/@react-native-community/cli
npm ERR! @react-native-community/cli@"^8.0.4" from react-native@0.69.6
npm ERR! react-native@"0.69.6" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional react-native@">=0.70.0" from realm@11.0.0
npm ERR! node_modules/realm
npm ERR! realm@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native@0.70.4
npm ERR! node_modules/react-native
npm ERR! peerOptional react-native@">=0.70.0" from realm@11.0.0
npm ERR! node_modules/realm
npm ERR! realm@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
我们遵循了几个教程。其中之一是Quick start with Sync
我们显然遗漏了一些东西。 有人可以帮忙吗?
【问题讨论】:
-
我猜想在设置环境时错过了一步 - 至少这是错误所表明的。例如,您是否这样做
npm install -g expo-cli来安装expo cli?如果是这样,是否有任何错误?我会退后一步,首先按照Realm Expo Guide 设置一个标准应用程序。看看情况如何。
标签: node.js react-native expo realm