我尝试使用这些instructions将本机版本从0.41升级到0.44,但我收到此错误:
error Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/lwansbrough/react-native-camera.git /Users/abdelnacer/Library/Caches/Yarn/v1/.tmp/264e7f98ae7b8a32797877705f218964
Directory: /Users/abdelnacer/work/react/DuluxTradePoints
Output:
fatal: working tree '.' already exists.
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'yarn add react-native@0.42.0' exited with code 1:
stderr: undefinederror Command failed.
Exit code: 128
Command: git
Arguments: clone https://github.com/lwansbrough/react-native-camera.git /Users/abdelnacer/Library/Caches/Yarn/v1/.tmp/264e7f98ae7b8a32797877705f218964
Directory: /Users/abdelnacer/work/react/DuluxTradePoints
Output:
fatal: working tree '.' already exists.
stdout: yarn add v0.24.5
[1/4] Resolving 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 emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
git-upgrade ERR! Restore initial sources
Note: checking out 'project-snapshot'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 4c8828d... Project snapshot
可能有人有任何想法我做错了吗?
答案 0 :(得分:3)
我尝试了几个yarn
+ react-native-git-upgrade
,但它对我不起作用
要进行升级工作,我必须删除node_modules并清理纱线缓存。
1)删除node_modules :
rm -rf ./node_modules
2)清洁纱线缓存
rm -rf /Users/<myUsername>/Library/Caches/Yarn/v1/.tmp
yarn cache clean
我不确定是否只能删除.tmp
3)运行 yarn
4)再次升级
react-native-git-upgrade
注意:我的升级是从0.51.0到0.53.3
答案 1 :(得分:1)
面对同样的问题,
尝试运行
yarn
然后
react-native-git-upgrade
或
它可能对你有帮助:
https://github.com/facebook/react-native/issues/11578#issuecomment-278022460