I'm trying to upgrade from RN 0.57.8 to 0.59.0.
Unfortunately I'm trapped in a double bind because:
react-native-git-upgrade 0.59.0 fails with the following error:
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: ENOENT: no such file or directory, stat './node_modules/react-native/local-cli/generator/copyProjectTemplateAndReplace.js'
I've found this issue, where it is suggested to use the new upgrade command of the CLI.
But, the version I'm running tells me to use react-native-git-upgrade instead 8()
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
What should I do to upgrade to 0.59.0
Same problem here.
https://github.com/react-native-community/react-native-releases/issues/100#issuecomment-472111011
Bump react-native to 0.59 in your package.json, run npm/yarn install, then run react-native upgrade --legacy
Alternatively: You can follow the recommendations here for getting to 0.59
I would have preferred the react-native-git-upgrade route because this will be a lot of work after using this legacy mode.
EDIT: this legacy switch is just to turn off the warning.
It took me ~20 minutes to upgrade from 0.58.5 to 0.59 by applying the diffs here: https://github.com/react-native-community/rn-diff-purge/compare/version/0.58.6...version/0.59.0
Hopefully going forward, react-native upgrade will work well.
They got rid of react-native-git-upgrade because "This tool doesn't work and is a frequent source of pain for people. Nobody maintains it. Let's kill it and stop recommending it to people"
I could understand that, but the fact is that I have numerous clients and doing it for each of their apps is going to be tedious and error prone.
Can you try npx @react-native-community/cli upgrade? It will use the new upgrade while you don't have it already. We noticed however that in some projects the git patch is not applied as expected (even when done manually) and it results in only package.json and lockfile being changed. If that happens to you, please report here, ideally with a repro: https://github.com/react-native-community/react-native-cli/issues/230
The React Native 0.59 blog post covers this topic. Upgrading has been painful for people in the past, and people we work with closely have had success using rn-diff-purge to upgrade to 0.59. Once you're on 0.59, you can use the new upgrade command by default, or you can follow the advice above to directly use the latest React Native CLI.
Since the aim of this thread is to discuss the upgrade process, I recommend using the existing Upgrading React Native thread in the Discussions repository. I am closing this issue in favor of the existing one.
The React Native 0.59 blog post covers this topic. Upgrading has been painful for people in the past, and people we work with closely have had success using rn-diff-purge to upgrade to 0.59. Once you're on 0.59, you can use the new upgrade command by default, or you can follow the advice above to directly use the latest React Native CLI.
Since the aim of this thread is to discuss the upgrade process, I recommend using the existing Upgrading React Native thread in the Discussions repository. I am closing this issue in favor of the existing one.
I must say that even though it is covered in the blog post, it is covered really poorly. It took me a few tries and about one day to manage to upgrade to 0.59.
Once I have some time I'll add a full upgrade guide to this comment though I strongly recommend that the blog post will be revised.
@jeffreyffs Your solution was wayyyy easier and quicker! I just upgraded from 0.56 to 0.59 without the hassle I usually have using react-native-git-upgrade.
@amitassaraf can you elaborate on what can be done to revise it? I'd appreciate some concrete feedback on what we can do to make the process clearer.
@hramos For me it was not clear what I was supposed to do. I understood I need to apply changes manually and that is about it.
The following are the steps I took and I think they should be added / explained better in the blog post.
Compare column link and apply all changes that were made there manually on your project.yarn / npm install, this will officially put your project on RN v0.59.0 _[This is the main step that is missing from the blog post imo]_react-native upgrade to upgrade your project to the latest RN version (0.59.1) using the new update command.pod install for iOS if needed and thats it, you are now on the latest RN version.For me the confusing parts were steps 2, 3, and 4. All that was written in the blog post was "Apply the changes manually".
It took me ~20 minutes to upgrade from 0.58.5 to 0.59 by applying the diffs here: react-native-community/rn-diff-purge@version/0.58.6...version/0.59.0
Hopefully going forward,
react-native upgradewill work well.They got rid of
react-native-git-upgradebecause "This tool doesn't work and is a frequent source of pain for people. Nobody maintains it. Let's kill it and stop recommending it to people"
How did you manage the diff concerning the project.pbxproj file, I don't really know how to deal with it :/
There should be no changes from rn-diff-purge in project.pbxproj. Which diff are you looking at?
For others..
In new versions, you need to start the server manually. Try react-native start and reload app again.
Most helpful comment
https://github.com/react-native-community/react-native-releases/issues/100#issuecomment-472111011
Bump
react-nativeto0.59in your package.json, runnpm/yarn install, then runreact-native upgrade --legacyAlternatively: You can follow the recommendations here for getting to 0.59