我正在遵循本指南: https://facebook.github.io/react-native/docs/upgrading.html
但是,我得到此打印输出:
> react-native upgrade 0.59
Scanning folders for symlinks in /Users/danale/Projects/engage-application.mobile/node_modules (18ms)
You should consider using the new upgrade tool based on Git. It makes upgrades easier by resolving most conflicts automatically.
To use it:
- Go back to the old version of React Native
- Run "npm install -g react-native-git-upgrade"
- Run "react-native-git-upgrade"
See https://facebook.github.io/react-native/docs/upgrading.html
Upgrading project to react-native v0.53.3
Check out the release notes and breaking changes: https://github.com/facebook/react-native/releases/tag/v0.53.0
.babelrc has changed in the new version.
Do you want to keep your .babelrc or replace it with the latest version?
If you ever made any changes to this file, you'll probably want to keep it.
You can see the new version here: /Users/danale/Projects/engage-application.mobile/node_modules/react-native/local-cli/templates/HelloWorld/_babelrc
Do you want to replace .babelrc? Answer y to replace, n to keep your version:
我终止了该过程,是因为对于为什么它认为我试图升级到已经拥有的版本感到困惑?
如果我尝试输出中的建议,则会收到此错误:
Output:
fatal: working tree '.' already exists.
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'yarn add react-native@0.59.9 react@16.8.3' exited with code 1:
stderr: undefinedwarning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
warning babel-preset-env > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
error Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/jjd314/react-native-swipe-view /Users/danale/Library/Caches/Yarn/v2/.tmp/657474cb39d30bc7457c09c627f92462
Directory: /Users/danale/Projects/engage-application.mobile
Output:
fatal: working tree '.' already exists.
stdout: yarn add v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
at ChildProcess.child.on.code (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:58:18)
at ChildProcess.emit (events.js:197:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
git-upgrade ERR! Restore initial sources
Note: checking out 'project-snapshot'.
答案 0 :(得分:0)
您没有正确使用react-native upgrade
命令。您已链接到的指南说明您需要:
npm install --save react-native@0.59
react-native upgrade