我不久前才开始在EXPO中使用REACTIVE Native,所以我有点困惑.

try 使用以下命令构建应用程序时:

eas build --profile development --platform android

当到达安装依赖项部分时,构建失败

Running "npm install" in the root dir of your repository 2[stderr] npm ERR! code ERESOLVE3[stderr] npm ERR!4[stderr] ERESOLVE could not resolve5[stderr] npm ERR! 6[stderr] npm ERR!7[stderr] While resolving: @react-native-firebase/auth@16.2.08[stderr] npm ERR! Found: @react-native-firebase/app@15.4.09[stderr] npm ERR! node_modules/@react-native-firebase/app10[stderr] npm ERR!   @react-native-firebase/app@"~15.4.0" from the root project11[stderr] npm ERR! 12[stderr] npm ERR! Could not resolve dependency:13[stderr] npm ERR! peer @react-native-firebase/app@"16.2.0" from @react-native-firebase/auth@16.2.014[stderr] npm ERR! node_modules/@react-native-firebase/auth15[stderr] npm ERR!   @react-native-firebase/auth@"^16.2.0" from the root project16[stderr] npm17[stderr] ERR! 18[stderr] npm ERR! Conflicting peer dependency: @react-native-firebase/app@16.2.019[stderr] npm ERR! node_modules/@react-native-firebase/app20[stderr] npm ERR!   peer @react-native-firebase/app@"16.2.0" from @react-native-firebase/auth@16.2.021[stderr] npm ERR!   node_modules/@react-native-firebase/auth22[stderr] npm ERR!     @react-native-firebase/auth@"^16.2.0" from the root project23[stderr] npm ERR! 24[stderr] npm ERR! Fix the upstream dependency conflict, or retry25[stderr] npm ERR! this command with --force, or --legacy-peer-deps26[stderr] npm ERR! to accept an incorrect (and potentially broken) dependency resolution.27[stderr] npm ERR! 28[stderr] npm ERR! See /home/expo/.npm/eresolve-report.txt for a full report.29[stderr] 30[stderr] npm ERR! A complete log of this run can be found in:31[stderr] npm ERR!     /home/expo/.npm/_logs/2022-11-26T18_50_07_398Z-debug-0.log32npm exited with non-zero code: 1

我已try 清除缓存并重新构建应用程序.当我try npx expo start --dev-client时,这款应用运行良好.

这是我的package.json分:

{
    "name": "wallet",
    "version": "1.0.0",
    "main": "node_modules/expo/AppEntry.js",
    "scripts": {
        "start": "expo start",
        "android": "expo start --android",
        "ios": "expo start --ios",
        "web": "expo start --web"
    },
    "dependencies": {
        "@react-native-firebase/app": "~15.4.0",
        "@react-native-firebase/auth": "^16.2.0",
        "@react-native-google-signin/google-signin": "^8.0.1",
        "@react-navigation/bottom-tabs": "^6.4.0",
        "@react-navigation/drawer": "^6.5.0",
        "@react-navigation/material-top-tabs": "^6.3.0",
        "@react-navigation/native": "^6.0.13",
        "@react-navigation/native-stack": "^6.9.1",
        "@rneui/base": "^4.0.0-rc.7",
        "@rneui/themed": "^4.0.0-rc.7",
        "expo": "~46.0.16",
        "expo-dev-client": "~1.3.1",
        "expo-font": "~10.2.0",
        "expo-linear-gradient": "~11.4.0",
        "expo-local-authentication": "~12.3.0",
        "expo-status-bar": "~1.4.0",
        "formik": "^2.2.9",
        "moment": "^2.29.4",
        "react": "18.0.0",
        "react-native": "0.69.6",
        "react-native-gesture-handler": "~2.5.0",
        "react-native-icon-badge": "^1.1.3",
        "react-native-linear-gradient": "^2.6.2",
        "react-native-pager-view": "^5.4.24",
        "react-native-reanimated": "~2.9.1",
        "react-native-recaptcha-that-works": "^1.3.2",
        "react-native-safe-area-context": "^4.3.1",
        "react-native-screens": "~3.15.0",
        "react-native-tab-view": "^3.3.0",
        "react-native-webview": "11.23.0",
        "styled-components": "^5.3.6"
    },
    "devDependencies": {
        "@babel/core": "^7.12.9"
    },
    "private": true
}

推荐答案

在深入研究了特定的缺失或冲突的依赖项之后,我设法通过以下方式修复了问题:

  1. 删除node_modules(从终端)和rm -rf node_modules.
  2. 更新对18.1.0版的react
  3. 安装REACTION-DOM 18.1.0 经过这一切,我设法用EAS构建了这款应用程序,但在我启动它后,它立即崩溃了,在我的设备上没有出现错误.

在通过将设备连接到我的PC来调试设备错误后, 我发现我的一些expo依赖项没有更新,所以我使用了以下内容: expo doctor --fix dependencies.

在那之后,这款应用程序终于推出了.正确启动

谢谢你,@Kaosc,你把我带到了这个地步.

上面的一些事情可能没有联系,但我就是这么做的.

React-native相关问答推荐

AWS Amplify处理后端错误

Appcenter codepush 返回请求被阻止

Error: Invariant Violation: Touchable child must either be native or forward setNativeProps to a native component stack

redux-observable 您在预期流的地方提供了 undefined

withNavigation 只能用于导航器的视图层次 struct

React Native 入门元素Bundle 失败,出现 Unexpected Token 错误

如何在 React Native For Android 中删除启动画面后的白屏

在使用 redux-persist 重新水化存储之前加载初始状态的默认值

react-native 从右到左

在 React Native 中仅显示第一行文本

FlatList contentContainerStyle -> justifyContent: 'center' 导致滚动问题

React Native:无法点击调试菜单

react native图像不适用于特定 URL

mapDispatchToProps:有什么意义吗?

XCode AppIcon 基于方案

在 ReactNative 中单击按钮时如何获取 TextInput 中的值

React Native 模块中的依赖注入

react-native iOS 应用在部署后不显示静态/本地资源

如何构建一个 react-native 应用程序,以便它在 ipad 上作为 ipad 应用程序运行?

React Native - 导航问题undefined is not an object (this.props.navigation.navigate)