繁体   English   中英

react-native - 设置基本项目的警告

[英]react-native - warnings setting up basic project

我试图使用 CLI 在 ReactNative 中初始化一个项目,我给出的命令是: npx react-native init testy output 看起来像这样:

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'是我遇到的错误并从一个新的开始那么项目。

任何帮助表示赞赏。

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

我希望这有帮助。

React-native init 的问题/警告(无锁文件;不推荐使用 connect2.x 系列;react 具有未满足的对等依赖性)

此修复适用于以下错误。

与 npm:

npm install --save @babel/runtime

或用纱线:

yarn add @babel/runtime

并再次构建项目

npm run start --reset-cache

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

npm install -g yarn

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM