You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

克隆React Native项目后yarn遇peer依赖警告及自动提示消失求助

Troubleshooting Peer Dependency Warnings & Missing Autocomplete in Your React Native Project

Hey there! Let's break down your issues step by step—these are common hurdles when working with older React Native projects, so we'll tackle them one by one.

1. Understanding & Fixing Peer Dependency Warnings

First, let's look at the warnings you saw after running cd /path/to/project/ && yarn:

warning " > react-native-looped-carousel@0.1.13" has incorrect peer dependency "react-native@^0.54.0".
warning " > react-navigation-stack@1.10.3" has incorrect peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning " > @react-native-community/eslint-config@0.0.5" has unmet peer dependency "eslint@>=5".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-eslint-comments@3.1.2" has unmet peer dependency "eslint@>=4.19.1".
warning "@react-native-community/eslint-config > babel-eslint@10.0.1" has unmet peer dependency "eslint@>= 4.12.1".
warning "@react-native-community/eslint-config > eslint-plugin-flowtype@2.50.3" has unmet peer dependency "eslint@>=2.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-jest@22.4.1" has unmet peer dependency "eslint@>=5".
warning "@react-native-community/eslint-config > eslint-plugin-react-hooks@1.7.0" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has unmet peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has unmet peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has unmet peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin > @typescript-eslint/experimental-utils@1.13.0" has unmet peer dependency "eslint@*".

These warnings pop up because packages declare "peer dependencies"—specific versions of other tools they need to work correctly. Your project's current dependency versions don't match those expectations. Here's how to fix them:

Most of your warnings tie back to @react-native-community/eslint-config@0.0.5 requiring eslint@>=5. Your project likely has an ESLint version that's either too old or too new. Fix this by installing a compatible version:

yarn add eslint@5.16.0 --dev

This will satisfy all ESLint-related peer requirements from sub-packages like eslint-plugin-react and @typescript-eslint/eslint-plugin.

  • react-native-looped-carousel@0.1.13: This is a very outdated package (last updated in 2018) built for React Native 0.54.0. You have two options:
    1. Swap it for a maintained alternative like react-native-snap-carousel (actively updated and compatible with modern RN versions)
    2. Temporarily ignore the warning with yarn install --ignore-peer-deps (note: this might cause unexpected bugs if the package doesn't play nice with your RN version)
  • react-navigation-stack@1.10.3: It needs react-native-screens@^1.0.0. Install a compatible version:
    yarn add react-native-screens@1.0.0-alpha.23 --dev
    
    If you don't want to use react-native-screens, you can disable it in your navigation config by adding useScreens(false) (check the react-navigation-stack docs for exact setup steps).

2. Fixing the Missing Autocomplete Feature

Your autocomplete disappearing is almost certainly linked to incomplete or mismatched dependencies—editor language services rely on properly installed tools like ESLint and TypeScript to work. Try these steps:

  • First, fix the peer dependency issues above: This ensures all tools powering autocomplete are set up correctly.
  • Restart your editor: Editors often cache dependency state; closing and reopening it can refresh the language service.
  • Check editor plugins: Make sure you have React Native-specific plugins installed (like VS Code's React Native Tools) and enabled.
  • Verify project configuration:
    • For TypeScript projects, check tsconfig.json to ensure the include array covers your source files (e.g., "include": ["src/**/*", "*.ts", "*.tsx"]).
    • For JavaScript projects, add a jsconfig.json file in your project root:
      {
        "compilerOptions": {
          "target": "es6",
          "module": "commonjs",
          "allowSyntheticDefaultImports": true
        },
        "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
      }
      
  • Reinstall dependencies with a clean cache:
    yarn cache clean
    yarn install
    
    This clears any corrupted cached packages that might be causing issues.

内容的提问来源于stack exchange,提问作者Pratap Sharma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:44:28