2017-08-22 29 views
2

我試圖升級的反應從0.41原生版本使用這些instructions 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 [email protected]' 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 

可能是別人有什麼,我做錯了什麼想法?

回答

1

我試了幾個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.5-1.0至0.53.3