【问题标题】:react-native - warnings setting up basic projectreact-native - 设置基本项目的警告
【发布时间】:2019-11-22 13:57:40
【问题描述】:

我试图使用 CLI 在 ReactNative 中启动一个项目,我给出的命令是: npx react-native init testy 输出如下所示:

This will walk you through creating a new React Native project in C:\Users\Vipul\ReactProjects\testy
Using yarn v1.19.1
Installing react-native...
yarn add v1.19.1
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > @react-native-community/cli > metro-core > jest-haste-map > fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro-react-native-babel-transformer@0.56.3" has unmet peer dependency "@babel/core@*".
warning " > react-native@0.61.4" has unmet peer dependency "react@16.9.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 381 new dependencies.
...
...
info Setting up new React Native app in C:\Users\Vipul\ReactProjects\testy
info Adding required dependencies
yarn add v1.19.1
[1/4] Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^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/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 179 new dependencies.
...
...
info Adding required dev dependencies
yarn add v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["@babel/core@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-core-7.7.2-ea5b99693bcfc058116f42fa1dd54da412b29d91-integrity\\node_modules\\@babel\\core" as pattern ["@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.0.0","@babel/core@^7.1.0","@babel/core@^7.1.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["@babel/runtime@^7.7.2"] is trying to unpack in the same destination "C:\\Users\\Vipul\\AppData\\Local\\Yarn\\Cache\\v6\\npm-@babel-runtime-7.7.2-111a78002a5c25fc8e3361bedc9529c696b85a6a-integrity\\node_modules\\@babel\\runtime" as pattern ["@babel/runtime@^7.0.0"]. This could result in non-deterministic behavior, skipping.
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react@7.12.4" has incorrect peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0".
warning "@react-native-community/eslint-config > eslint-plugin-react-native@3.6.0" has incorrect peer dependency "eslint@^3.17.0 || ^4 || ^5".
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".

package.json 文件如下所示:

{
  "name": "testy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.4"
  },
  "devDependencies": {
    "@babel/core": "^7.7.2",
    "@babel/runtime": "^7.7.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.6.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.57.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

现在我想知道这些警告以后是否会影响我的项目。如何删除它们,即使我没有指定它们,为什么 RN 甚至使用不正确或未满足的依赖项?

请注意,在此之前我也尝试构建一个 RN 项目,这里 React Native - Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from 'index.js' 是我遇到的错误,然后开始了一个新项目。

感谢任何帮助。

【问题讨论】:

    标签: node.js react-native npm yarnpkg


    【解决方案1】:

    首先,它不应该影响您的项目。 React Native 依赖于许多核心依赖项,每次更新时,它都会尝试减少这些核心依赖项。但是,这个 SO 响应应该更好地解释。

    我希望这会有所帮助。

    Issues/warnings with React-native init (no-lockfile;connect2.x series is deprecated;react has unmet peer dependency)

    【讨论】:

      【解决方案2】:

      此修复适用于以下错误。

      使用 npm:

      npm install --save @babel/runtime
      

      或者用纱线:

      yarn add @babel/runtime
      

      然后再次构建项目

      npm run start --reset-cache
      

      【讨论】:

      【解决方案3】:

      以防其他人再次搜索此错误。 就我而言,我通过更新我的纱线包来解决它。

      npm install -g yarn
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-11-16
        • 1970-01-01
        • 1970-01-01
        • 2016-03-14
        • 1970-01-01
        • 1970-01-01
        • 2020-01-06
        • 2022-12-01
        相关资源
        最近更新 更多