想要的包,运行expo doctor发现无效

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

我刚刚在博览会日志上构建我的应用程序时看到了该警告。然后我在当地运行 expo doctor 并出现以下警告。我尝试删除 package-lock.json 和节点模块,然后运行“npm install”但无法修复它。有什么办法可以解决吗

expo doctor log:

    √ Found all copies of expo-modules-autolinking
        Expected package expo-modules-autolinking@~0.8.1
        Found invalid:
          [email protected]
          (for more info, run: npm why expo-modules-autolinking)
    
        √ Found all copies of @expo/config-plugins
        Expected package @expo/config-plugins@^4.1.0
        Found invalid:
          @expo/[email protected]
          (for more info, run: npm why @expo/config-plugins)
    
        √ Found all copies of @expo/prebuild-config
        Expected package @expo/prebuild-config@^4.0.0
        Found invalid:
          @expo/[email protected]
          (for more info, run: npm why @expo/prebuild-config)
        
        🎉 Didn't find any issues with the project!

package.json

"@expo/config-plugins": "^4.1.5",
"@expo/prebuild-config": "^4.0.0",
"expo-modules-autolinking": "~0.8.1",
react-native expo
6个回答
10
投票

大家好,只需在 Ur package.json 文件(Ur 项目的根目录)中添加以下代码即可。然后删除你项目中的所有node_module文件。

"resolutions": {
"@expo/config-plugins": "^4.1.0",
"@expo/prebuild-config": "^4.0.0",
"expo-modules-autolinking": "~0.8.1"
} 

2
投票

按照here的建议,“解决方案”仅适用于Yarn

对于 npm,您应该使用“overrides”(请参阅 npm 的覆盖文档)。


1
投票

“package.json”文件中的“npm”“覆盖”对我来说适用于 Expo SDK 48

{
  "scripts": {
  },
  "dependencies": {
    "expo": "~48.0.18",
    "react": "18.2.0",
    "react-native": "0.71.8"
  },
  "overrides": {
    "expo-modules-autolinking": "~1.1.0",
    "@expo/config-plugins": "~6.0.0",
    "@expo/prebuild-config": "~6.0.0"
  }
}

不要忘记在“npm install”之前删除“node_modules”文件和“package-lock.json”


0
投票

将此行放入 package.json 中:

"resolutions": {
  "expo-modules-autolinking": "~0.8.1"
},

0
投票

对于第 45 届世博会,请添加以下决议:

  "resolutions": {
    "standard-version-expo/**/@expo/config-plugins": "4.1.0"
  },

更多背景信息:https://github.com/expo-community/standard-version-expo/issues/45


0
投票

我在项目的package.json上使用了eas-cli,但是当我全局安装eas-cli时,它工作正常。没有显示任何更新消息。

  1. 首先我从我的项目中卸载了 eas-cli
    npm uninstall eas-cli
  2. 我在全球安装了 eas-cli
    npm install eas-cli --global
  3. 然后我用
    npx expo-doctor
  4. 运行了 expo-doctor

我的package.json:

"dependencies": {
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/stack": "^6.4.1",
    "expo": "~51.0.26",
    "expo-av": "~14.0.6",
    "expo-status-bar": "~1.12.1",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-native": "0.74.5",
    "react-native-config": "^1.5.3",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-maps": "1.14.0",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-webview": "13.8.6"
  },
  "devDependencies": {
    "@babel/core": "^7.24.0",
    "@types/geojson": "^7946.0.14",
    "@types/react": "~18.2.79",
    "eslint": "^8.56.0",
    "eslint-config-universe": "^12.0.0",
    "prettier": "^3.2.5",
    "tailwindcss": "^3.3.2",
    "typescript": "~5.3.3"
  },

世博医生日志:

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check for issues with metro config
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!
© www.soinside.com 2019 - 2024. All rights reserved.