我试图使用命令行界面在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'是我遇到的错误,于是我开始了一个新的项目。
任何帮助都是非常感谢的。
发布于 2019-11-23 03:23:09
首先,不应该影响你的项目。React原生依赖于许多核心依赖项,并且在每次更新时,它都会尝试减少这些核心依赖项。然而,这样的回答应该能更好地解释。
我希望这能帮到你。
发布于 2019-11-22 22:09:07
此修复适用于以下错误。
使用npm:
npm install --save @babel/runtime或者用纱线:
yarn add @babel/runtime并使用以下命令重新构建项目
npm run start --reset-cache发布于 2020-02-17 14:16:41
以防其他人再次搜索这个错误。对于我的情况,我通过更新我的纱线包来解决它。
npm install -g yarnhttps://stackoverflow.com/questions/58995782
复制相似问题