升级Expo SDK 53至54后iOS开发构建失败求助
Expo SDK 54升级后iOS模拟器开发构建失败问题
我刚从SDK 53升级至SDK 54,过程原本还算顺利,但尝试为iOS模拟器构建开发版本时,持续出现错误。不确定问题所在,似乎是在等待过时的包版本?多次删除node_modules和package-lock.json后用npm install重新生成,但毫无头绪。昨天刚把Node升级到v20.19.4,npm版本为10.8.2。
我的package.json:
{ "main": "index.js", "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "web": "expo start --web", "start": "expo start --dev-client" }, "dependencies": { "@react-native-community/datetimepicker": "8.4.4", "@react-navigation/bottom-tabs": "^7.4.7", "@react-navigation/drawer": "^7.5.8", "@react-navigation/native": "^7.1.17", "@react-navigation/stack": "^7.4.8", "axios": "^0.21.1", "expo": "^54.0.0", "expo-constants": "~18.0.8", "expo-dev-client": "~6.0.12", "expo-device": "~8.0.7", "expo-document-picker": "~14.0.7", "expo-file-system": "~19.0.14", "expo-font": "~14.0.8", "expo-image-manipulator": "~14.0.7", "expo-image-picker": "~17.0.8", "expo-localization": "~17.0.7", "expo-media-library": "~18.1.1", "expo-navigation-bar": "~5.0.8", "expo-network": "~8.0.7", "expo-notifications": "~0.32.11", "expo-screen-capture": "~8.0.8", "expo-secure-store": "~15.0.7", "expo-splash-screen": "~31.0.10", "expo-status-bar": "~3.0.8", "expo-updates": "~29.0.10", "expo-web-browser": "~15.0.7", "i18next": "^20.2.4", "moment": "^2.29.1", "react": "19.1.0", "react-dom": "19.1.0", "react-hook-form": "^7.41.1", "react-i18next": "^11.10.0", "react-native": "0.81.4", "react-native-countdown-component": "^2.7.1", "react-native-dropdown-picker": "^5.1.15", "react-native-gesture-handler": "~2.28.0", "react-native-maps": "1.20.1", "react-native-modal": "^14.0.0-rc.1", "react-native-modal-datetime-picker": "^18.0.0", "react-native-paper": "^5.13.3", "react-native-reanimated": "~4.1.0", "react-native-render-html": "^6.3.4", "react-native-responsive-fontsize": "^0.5.1", "react-native-safe-area-context": "~5.6.0", "react-native-screens": "~4.16.0", "react-native-svg": "15.12.1", "react-native-worklets": "^0.5.1", "socket.io-client": "^4.1.3" }, "devDependencies": { "@babel/core": "^7.24.0", "@types/jest": "^29.2.5", "@types/react": "^19.1.13", "typescript": "~5.9.2" }, "private": true, "name": "mobile-react-native", "version": "2.0.0" }

使用之前多次执行过的命令eas build --platform ios --profile development --clear-cache进行构建,但现在出现如下错误:
Running "npm ci --include=dev" in /Users/expo/workingdir/build directory npm error code EUSAGE npm error npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing. npm error npm error Missing: @types/react-native@0.72.8 from lock file npm error Missing: @react-native/virtualized-lists@0.72.8 from lock file npm error npm error Clean install a project npm error npm error Usage: npm error npm ci npm error npm error Options: npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling] npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]] npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit] npm error [--no-bin-links] [--no-fund] [--dry-run] npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] npm error [-ws|--workspaces] [--include-workspace-root] [--install-links] npm error npm error aliases: clean-install, ic, install-clean, isntall-clean npm error npm error Run "npm help ci" for more info npm error A complete log of this run can be found in: /Users/expo/.npm/_logs/2025-09-17T07_13_48_966Z-debug-0.log npm ci --include=dev exited with non-zero code: 1
已尝试的解决方法:
- 删除node_modules和package-lock.json后重新执行
npm install。 - 本地执行
npm ci成功,但构建仍失败。 - 在eas.json中指定Node版本:
"development": { "node": "20.19.4", "developmentClient": true, "distribution": "internal", "ios": { "simulator": true } }
- 在根目录添加.nvmrc文件(内容为20或20.19.4),并在package.json中添加
"packageManager": "npm@10"。 - 强制清空缓存后重新执行步骤1。
内容的提问来源于stack exchange,提问作者Omar Sherif
相关产品推荐
相关产品推荐

