gpt4 book ai didi

react-native - React Native 升级失败 : fatal: working tree '.' already exists

转载 作者:行者123 更新时间:2023-12-04 05:13:13 26 4
gpt4 key购买 nike

我尝试使用这些 instructions 将 React native 版本从 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

可能有人知道我做错了什么?

最佳答案

我尝试了几种 yarn + react-native-git-upgrade 但它对我不起作用

为了升级工作,我必须删除 node_modules 并清理 yarn 缓存。

1) 删除 node_modules:

rm -rf ./node_modules

2) 清理 yarn 缓存

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

关于react-native - React Native 升级失败 : fatal: working tree '.' already exists,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45814730/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com