react-native: [0.57.0-rc.0] react-native-git-upgrade and old school upgrade are broken
Environment
React Native Environment Info:
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 8.52 GB / 15.95 GB
Binaries:
Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.0 - C:\Program Files\nodejs\npm.CMD
I’m upgrading from React Native 0.56.0.
Description
PS C:\Users\Gary\Documents\code\WonderSwipe> react-native-git-upgrade.cmd 0.57.0-rc.0
git-upgrade info Check for updates
git-upgrade info Using yarn 1.9.4
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.57.0-rc.0, React 16.4.1
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Plugin 0 specified in "C:\\Users\\Gary\\Documents\\code\\WonderSwipe\\node_modules\\babel-preset-react-native\\index.js" provided an invalid property of "default" (While processing preset: "C:\\Users\\Gary\\Documents\\code\\WonderSwipe\\node_modules\\babel-preset-react-native\\index.js")
at Plugin.init (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\plugin.js:131:13)
at Function.normalisePlugin (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:152:12)
at C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
at OptionManager.mergeOptions (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
at C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:14
at C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:323:22
at Array.map (<anonymous>)
at OptionManager.resolvePresets (C:\Users\Gary\AppData\Roaming\npm\node_modules\react-native-git-upgrade\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
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>
Reproducible Demo
Run react-native-git-upgrade 0.57.0-rc.0. I can reproduce same error on both Windows and MacOS (latest High Sierra).
I’ve never encountered a similar breakage with git-upgrade for about the last 10 version of RN upgrades I’ve done with react-native-git-upgrade.
Ref: https://github.com/react-native-community/react-native-releases/issues/34
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 16 (3 by maintainers)
Commits related to this issue
- ignore babelrc in git-upgrade Per [this comment on the issue](https://github.com/facebook/react-native/issues/20710#issuecomment-414631827): > Babel by default tries to find .babelrc files to conf... — committed to ngraef/react-native by ngraef 6 years ago
- ignore babelrc in git-upgrade (#20790) Summary: Per [this comment on the issue](https://github.com/facebook/react-native/issues/20710#issuecomment-414631827): > Babel by default tries to find .babel... — committed to facebook/react-native by ngraef 6 years ago
- ignore babelrc in git-upgrade (#20790) Summary: Per [this comment on the issue](https://github.com/facebook/react-native/issues/20710#issuecomment-414631827): > Babel by default tries to find .babel... — committed to aleclarson/react-native by ngraef 6 years ago
- ignore babelrc in git-upgrade (#20790) Summary: Per [this comment on the issue](https://github.com/facebook/react-native/issues/20710#issuecomment-414631827): > Babel by default tries to find .babel... — committed to microsoft/react-native-macos by ngraef 6 years ago
- ignore babelrc in git-upgrade (#20790) Summary: Per [this comment on the issue](https://github.com/facebook/react-native/issues/20710#issuecomment-414631827): > Babel by default tries to find .babel... — committed to microsoft/react-native-macos by ngraef 6 years ago
I’ve done some investigation and the original reported issue is caused by
react-native-git-upgradeusing still Babel 6 to transpile itself:https://github.com/facebook/react-native/blob/9c1ea45d38a6ec731894443debe8879fa3876ab7/react-native-git-upgrade/cli.js#L12-L19
Babel by default tries to find
.babelrcfiles to configure itself, and once it finds the one from the RN app (which links to the RN preset that only works on Babel 7) it fails.The easiest patch to fix this issue is to add
babelrc: falseto thebabel-registermethod, so Babel does not read any additional.babelrcfile.@fungilation can you give this a try? feel free to send a PR if this fixes the issue 😃
I guess that I’ve to lock this issue too, apparently it’s impossible to avoid disruptive people when trying to fix issues related to release candidates 🤷♂️
I’ll keep saying it, it’s an open source project. Don’t you like something? Fork it and fix it yourself. Writing these kinds of comments is just pathetic.
EDIT: Apparently, the user who posted the disruptive comment deleted it. And yes, I have a screenshot of the comment.
EDIT2: Unlocking, hoping that the conversation will now move towards helpful interactions. And, again, PRs are the first way to move forward this issue.
I tried upgrading to react 57 rc by first
yarn add react-native-git-upgradeChange its cli.js to
yarn react-native-git-upgrade 0.57.0-rc.0
It does seem to upgrade the node modules to 0.57.0 but the package.json is not updated.
FWIW, @rafeca’s fix worked for me. Patched and ran
react-native-git-upgrade, resolved merge conflicts, cleaned up withnpm uninstall babel-preset-react-native, and I’m good to go (or rather, I’ve moved on to the next issue, #20712).Environment
Made those changes and ran
yarn. Confirmed thatyarn.lockshows babel deps now at 7.0.0-beta.56 instead of 7.0.0-beta.47 before, and metro went from 0.38.3 to 0.43.6. (not 0.43.5, a problem?)But running
react-native upgradehits the sameError: Cannot find module 'metro/src/blacklist'… as before.