React-native: Babel error when running react-native-git-upgrade

Created on 16 Apr 2018  路  10Comments  路  Source: facebook/react-native

Environment


Environment:
OS: macOS High Sierra 10.13.4
Node: 9.11.1
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: ^16.3.1 => 16.3.1
react-native: 0.54.2 => 0.54.2

Steps to Reproduce


I imagine this error occurs with all projects that utilize a 7.x beta version of Babel

Expected Behavior


I'm trying to upgrade from React Native 0.53.x to 0.55 via react-native-git-upgrade

Actual Behavior


I'm receiving the following error directly after the "Generate old version template" step:

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.0". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. 
Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "/Users/nickersoft/rnapp/node_modules/@babel/preset-flow/lib/index.js")

I'm currently using @babel/core (beta.44) for my project. My hunch is that react-native-git-upgrade is loading Babel via its own 6.x dependencies and calling babel-register, but once it hits the plugins and code I'm using it errors, seeing those expect 7.x. I've updated my code to use @babel/core and would prefer to not downgrade, but I'm curious if that's the only option. I tried the beta release of react-native-git-upgrade, thinking it might use Babel beta, but it doesn't. Any help would be appreciated. Thanks.

Help Wanted JavaScript Locked

Most helpful comment

Still actual while trying upgrade from 0.56 to 0.57. react-native-git-upgrade still uses babel@6 @hramos

All 10 comments

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

@react-native-bot I would, but this issue revolves around upgrading to v0.55... also, why did I respond to a bot?

The next release should use Babel 7 - the work has already begun on master - hopefully that should help with the upgrade.

@hramos Great to hear! 馃榿 I figured version compatibility was the culprit.

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

Still actual while trying upgrade from 0.56 to 0.57. react-native-git-upgrade still uses babel@6 @hramos

react-native-git-upgrade is known to not work as expected even in 0.57. This is part of the cli is community supported, feel free to send a PR if you're interested in helping out here.

Fixed in 0.58.

This file still specifies babel 6 on master. Guess I will wait for 58 but I was wondering if this is correct?
https://github.com/facebook/react-native/blob/master/react-native-git-upgrade/package.json

Was this page helpful?
0 / 5 - 0 ratings