从 expo SDK 47 升级到 48 时出错:“npx expo-doctor”命令失败

问题描述 投票:0回答:2

关于如何解决从 SDK47 升级到 48 的问题:“npx expo-doctor”命令失败有什么想法吗?

我按照博客中的说明进行操作:https://blog.expo.dev/expo-sdk-48-ccb8302e231

npx expo-doctor 生成以下错误:

✔ Check package.json for common issues
✔ Validate global prerequisites versions
✖ Check for incompatible packages
Unexpected error while running 'Check for incompatible packages' check:
Error: Dependency tree validation for @unimodules/core failed. This validation is only available on Node 16+ / npm 8.
✖ Check for conflicting global packages in project
Unexpected error while running 'Check for conflicting global packages in project' check:
Error: Dependency tree validation for expo-cli failed. This validation is only available on Node 16+ / npm 8.
✔ Validate Expo Config
✖ Verify prebuild support package versions are compatible
Unexpected error while running 'Verify prebuild support package versions are compatible' check:
Error: Dependency tree validation for @expo/prebuild-config failed. This validation is only available on Node 16+ / npm 8.
✔ Check compatible dependency versions for the installed Expo SDK
One or more checks failed, indicating possible issues with the project.

我卸载了( npm uninstall )所有三个模块:@unimodules/core、expo-cli、@expo/prebuild-config

对于它们中的每一个, npm ls 都是空的(并且它们已被弃用) 我删除了 node-Modules 和 package-lock.json。 我重新安装了expo(npm install expo) 我仍然遇到完全相同的问题。

之前,列出的第一个有问题的软件包是 @unimodules/reaact-native-adapter,我也卸载了它(无论如何都已弃用)。我尝试将节点升级到 v18。 我还在 package.json 中添加了“解决方案”,正如一些帖子中所建议的那样,并尝试了许多其他方法,但我仍然陷入困境...... eas 构建无法工作,因为 npx expo-doctor 失败。

任何想法都非常受欢迎......提前非常感谢!

npm:9.6.7 节点:v16.18.1

package.json:

{
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "lint": "eslint *.js **/*.js",
    "images": "node scripts/images.js"
  },
  "dependencies": {
    "@expo/samples": "~36.0.0",
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/bottom-tabs": "^6.3.2",
    "@react-navigation/material-top-tabs": "^6.2.2",
    "@react-navigation/native": "^6.0.11",
    "@react-navigation/native-stack": "^6.7.0",
    "@react-navigation/stack": "^6.0.11",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "acorn": "^7.1.1",
    "algoliasearch": "^4.14.2",
    "axios": "^0.21.4",
    "babel-preset-expo": "^9.3.0",
    "core-js": "^3.10.1",
    "css-what": "^5.0.1",
    "dayjs": "^1.10.7",
    "dayjs-plugin-utc": "^0.1.2",
    "expo": "~48.0.18",
    "expo-application": "~5.1.1",
    "expo-asset": "~8.9.1",
    "expo-blur": "~12.2.2",
    "expo-constants": "~14.2.1",
    "expo-contacts": "~12.0.1",
    "expo-dev-client": "~2.2.1",
    "expo-device": "~5.2.1",
    "expo-font": "~11.1.1",
    "expo-image-manipulator": "~11.1.1",
    "expo-image-picker": "~14.1.1",
    "expo-linking": "~4.0.1",
    "expo-notifications": "~0.18.1",
    "expo-permissions": "~14.1.1",
    "expo-random": "~13.1.1",
    "expo-secure-store": "~12.1.1",
    "expo-splash-screen": "~0.18.2",
    "expo-status-bar": "~1.4.2",
    "expo-task-manager": "~11.1.1",
    "expo-updates": "~0.16.4",
    "expo-web-browser": "~12.1.1",
    "firebase": "^8.10.0",
    "formik": "^2.2.9",
    "joi": "^17.4.0",
    "lodash": "^4.17.20",
    "minimist": "^1.2.6",
    "moment": "^2.27.0",
    "normalizr": "^3.6.0",
    "npm": "^6.14.5",
    "prop-types": "^15.7.2",
    "qs": "^6.10.1",
    "react": "18.2.0",
    "react-devtools-core": "^4.23.0",
    "react-dom": "18.2.0",
    "react-instantsearch-native": "^6.38.1",
    "react-native": "0.71.8",
    "react-native-base64": "0.0.2",
    "react-native-collapsible": "^1.5.3",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-gifted-chat": "^1.1.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-localize": "^2.0.1",
    "react-native-maps": "1.3.2",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "6.1.2",
    "react-native-reanimated": "~2.14.4",
    "react-native-responsive-screen": "^1.4.0",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-svg": "13.4.0",
    "react-native-tab-view": "^3.1.1",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7",
    "react-native-webview": "11.26.0",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.9",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-saga": "^1.1.3",
    "set-value": "^4.1.0",
    "sharp-cli": "^3.0.0",
    "unimodules-app-loader": "^4.1.1",
    "uuid": "^7.0.3",
    "yup": "^0.32.11",
    "expo-build-properties": "~0.6.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@types/react": "~18.0.24",
    "@types/react-native": "~0.70.6",
    "@types/react-test-renderer": "^16.9.2",
    "babel-preset-expo": "^9.3.0",
    "metro": "^0.72.3",
    "metro-config": "^0.72.3",
    "metro-core": "^0.72.3",
    "typescript": "^4.6.3"
  },
  "resolutions": {
    "@expo/config-plugins": "~6.0.0",
    "@expo/prebuild-config": "~6.0.0",
    "expo-modules-autolinking": "~1.1.0",
    "@expo/cli": "xxx"
  },
  "private": true,
  "name": "mApp",
  "version": "1.0.0"
}

react-native expo
2个回答
0
投票

我在升级到 Expo 48 时遇到同样的问题。这是我的解决方案。

  1. 删除node_modules文件夹

  2. package.json

    添加“分辨率”字段
      "resolutions": {
        "@expo/config-plugins": "~6.0.0",
        "@expo/prebuild-config": "~6.0.0"},
    
  3. 运行纱线安装


0
投票

我尝试了package.json中的解决方案,但它不起作用,尽管我在终端上输入了expo install,然后输入了expo升级,再次运行npx expo-doctor,unimodules警告消失了,这是针对Expo SDK 50的,直到那时我才能够在 expo 控制台上创建我的构建。

© www.soinside.com 2019 - 2024. All rights reserved.