![](/img/trans.png)
[英]Getting error when building iOS app by using EAS (Expo Application Services)
[英]EAS build error when reaching "install dependencies"
不久前我開始在 expo 中使用 React Native,所以我有點迷茫。
嘗試使用以下命令構建應用程序時:
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
我試過清除緩存並重建應用程序。 當我嘗試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
}
我今天在構建生產時遇到了同樣的問題。 我通過以下方式解決了安裝依賴項的問題:
yarn install
之后很容易切換到 yarn 而不是使用 npm 來安裝包。 希望它對你有用。
在深入研究了特定的缺失或沖突的依賴項之后,我設法通過以下方式解決了這個問題:
rm -rf node_modules.
刪除node_modules
(從終端)。 通過將設備連接到我的 PC 來調試我的設備錯誤后,我發現我的一些 expo 依賴項沒有更新,所以我使用了以下命令: expo doctor --fix dependencies.
在那之后,應用程序終於出現了。 正確啟動
謝謝你,@Kaosc,引導我解決這個問題。
上面的一些事情可能沒有聯系,但這就是我所做的。
我在項目根目錄的終端中執行了此操作:
expo doctor
它給了我這個:
Expected package @expo/config-plugins@^5.0.2
Found invalid:
@expo/config-plugins@4.0.6
(for more info, run: npm why @expo/config-plugins)
Some dependencies are incompatible with the installed expo package version:
- expo-status-bar - expected version: ~1.4.2 - actual version installed: 1.2.0
- expo-updates - expected version: ~0.15.6 - actual version installed: 0.11.7
- react - expected version: 18.1.0 - actual version installed: 18.2.0
- react-dom - expected version: 18.1.0 - actual version installed: 17.0.1
- react-native - expected version: 0.70.5 - actual version installed: 0.70.6
- react-native-reanimated - expected version: ~2.12.0 - actual version installed: 2.13.0
- react-native-safe-area-context - expected version: 4.4.1 - actual version installed: 3.3.2
- react-native-screens - expected version: ~3.18.0 - actual version installed: 3.10.2
- react-native-web - expected version: ~0.18.9 - actual version installed: 0.17.1
- react-native-webview - expected version: 11.23.1 - actual version installed: 11.15.0
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo doctor --fix-dependencies,
or install individual packages by running expo install [package-name ...]
然后我這樣做了:
expo doctor --fix-dependencies
然后我去這個,沒有更多的錯誤:
Expected package @expo/config-plugins@^5.0.2
Found invalid:
@expo/config-plugins@4.0.6
(for more info, run: npm why @expo/config-plugins)
Some dependencies are incompatible with the installed expo package version:
- expo-status-bar - expected version: ~1.4.2 - actual version installed: 1.2.0
- expo-updates - expected version: ~0.15.6 - actual version installed: 0.11.7
- react - expected version: 18.1.0 - actual version installed: 18.2.0
- react-dom - expected version: 18.1.0 - actual version installed: 17.0.1
- react-native - expected version: 0.70.5 - actual version installed: 0.70.6
- react-native-reanimated - expected version: ~2.12.0 - actual version installed: 2.13.0
- react-native-safe-area-context - expected version: 4.4.1 - actual version installed: 3.3.2
- react-native-screens - expected version: ~3.18.0 - actual version installed: 3.10.2
- react-native-web - expected version: ~0.18.9 - actual version installed: 0.17.1
- react-native-webview - expected version: 11.23.1 - actual version installed: 11.15.0
This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo install
Installing 10 SDK 47.0.0 compatible native modules using npm.
> npm install
added 10 packages, removed 97 packages, changed 33 packages, and audited 1216 packages in 2m
57 packages are looking for funding
run `npm fund` for details
7 vulnerabilities (1 low, 5 high, 1 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
刪除 package-lock.json 並重試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.