New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Couldn't find preset "module:metro-react-native-babel-preset" #21241

Closed
dylancompanjen opened this Issue Sep 21, 2018 · 71 comments

Comments

Projects
None yet
@dylancompanjen
Copy link

dylancompanjen commented Sep 21, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
Memory: 68.43 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 9.8.0 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.3.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Xcode: 10.1/10O23u - /usr/bin/xcodebuild
npmPackages:
react: ^16.5.2 => 16.5.2
react-native: ^0.57.0 => 0.57.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 1.2.0
react-native-git-upgrade: 0.2.7
react-native-rename: 2.2.2

Description

When trying to run "react-native-git-upgrade" it gives the following error:
git-upgrade ERR! An error occurred during upgrade:
Error: Couldn't find preset "module:metro-react-native-babel-preset" relative to directory "Users/...

Reproducible Demo

Try to upgrade from React Native 0.56 to 0.57 with "react-native-git-upgrade".

@HonzaHK

This comment has been minimized.

Copy link

HonzaHK commented Sep 21, 2018

Same here, trying to upgrade from 0.53 to 0.57 with "react-native-git-upgrade" on Ubuntu 18.04 LTS

@JanErikFoss

This comment has been minimized.

Copy link

JanErikFoss commented Sep 21, 2018

Same error, 0.57.0-rc.3 to 0.57.0 on Mojave 10.14 Beta

@canyara

This comment has been minimized.

Copy link

canyara commented Sep 21, 2018

yarn add metro-react-native-babel-preset --dev
https://github.com/facebook/metro/tree/master/packages/metro-react-native-babel-preset

@dylancompanjen

This comment has been minimized.

Copy link
Author

dylancompanjen commented Sep 21, 2018

@canyara I already added metro-react-native-babel-preset (and updated my babelrc). The bug still appears.

@kelset

This comment has been minimized.

Copy link
Collaborator

kelset commented Sep 21, 2018

It should be fixed now, make sure you are using metro 0.45.6 (a simple-reinstall of the node_modules should be enough).

@kelset kelset added the 📦Bundler label Sep 21, 2018

@dylancompanjen

This comment has been minimized.

Copy link
Author

dylancompanjen commented Sep 21, 2018

@kelset I'm still getting the same error.

@kelset

This comment has been minimized.

Copy link
Collaborator

kelset commented Sep 21, 2018

Then I suggest you try to upgrade your project following the manual steps we wrote in the changelog.

If that still happens for you then please create a sample project that reproduces the issue.

@Amnesthesia

This comment has been minimized.

Copy link

Amnesthesia commented Sep 21, 2018

I'm getting this as well, when upgrading from ReactNative 0.57.0-rc3, even with metro 0.45.6

=> Found "metro@0.45.6"
info Has been hoisted to "metro"
info Reasons this module exists
   - Specified in "devDependencies"
   - Hoisted from "metro#metro-config#metro"
info Disk size without dependencies: "1.64GB"
info Disk size with unique dependencies: "11.72GB"
info Disk size with transitive dependencies: "43.06GB"
info Number of shared dependencies: 247
@Amnesthesia

This comment has been minimized.

Copy link

Amnesthesia commented Sep 21, 2018

I seemed to have solved this by removing everything in the babelrc file:

# .babelrc
{
}

react-native-git-upgrade then tries to re-add this during installation. I kept removing it and re-saving the file, and it continued without crashing. Then I added the contents back.

@MaxInMoon

This comment has been minimized.

Copy link

MaxInMoon commented Sep 21, 2018

just a note from the metro's doc:

If you wish to use a custom Babel configuration by writing a .babelrc file in your project's root directory, you must specify all the plugins necessary to transform your code. React Native does not apply its default Babel configuration in this case. So, to make your life easier, you can use this preset to get the default configuration and then specify more plugins that run before it.

@sonaye

This comment has been minimized.

Copy link
Contributor

sonaye commented Sep 22, 2018

Same issue here when trying to upgrade over the last month.

  • 0.56.0 to 0.56.1, failed, waited for the new release.
  • 0.56.0 to 0.57.0, issue is still there, started a project from scratch on top 0.57.0.
  • 0.57.0 to 0.57.1, issue is still there.

Already followed the manual steps @kelset, and also updated metro to 0.45.6.

@canyara

This comment has been minimized.

Copy link

canyara commented Sep 22, 2018

@canyara I already added metro-react-native-babel-preset (and updated my babelrc). The bug still appears.

In my case, there is incompatible issue react 16.5.2 have with react-native 0.57. Downgrade to React 16.5.1, restart react-native everything is ok

@canyara

This comment has been minimized.

Copy link

canyara commented Sep 22, 2018

@dylancompanjen by the way, you need quit the react-native terminal and complete restart react-native if you already install metro-react-native-babel-preset

@Freddy03h

This comment has been minimized.

Copy link
Contributor

Freddy03h commented Sep 23, 2018

I'm facing the same issue while trying an upgrade from 0.56.0 to 0.57.1.

I followed manual update from the changelog (with fixed react@16.5.0) but react-native-git-upgrade still does the error

git-upgrade info Generate old version template
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Couldn't find preset "module:metro-react-native-babel-preset" relative to directory "/Users/myname/workspace/project"
    at /Users/myname/.config/yarn/global/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (/Users/myname/.config/yarn/global/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/Users/myname/.config/yarn/global/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/Users/myname/.config/yarn/global/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
    at OptionManager.init (/Users/myname/.config/yarn/global/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/Users/myname/.config/yarn/global/node_modules/babel-register/lib/node.js:103:45)
    at loader (/Users/myname/.config/yarn/global/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/myname/.config/yarn/global/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:561:32)
git-upgrade ERR! Restore initial sources

I deleted node_module, re-yarn, deleted yarn.lock, re-yarn, still the same.
react-native-git-upgrade@0.2.7

@kelset

This comment has been minimized.

Copy link
Collaborator

kelset commented Sep 24, 2018

I followed manual update from the changelog (with fixed react@16.5.0) but react-native-git-upgrade still does the error

Why would you follow the manual steps AND do the git-upgrade? 🤔

@Freddy03h

This comment has been minimized.

Copy link
Contributor

Freddy03h commented Sep 24, 2018

Why would you follow the manual steps AND do the git-upgrade? 🤔

To upgrade iOS and Android files like any other RN upgrade ?
react-native-git-upgrade directly from the 0.56.0 didn't work either.

@rottenoats

This comment has been minimized.

Copy link

rottenoats commented Sep 24, 2018

After starting a fresh project I got #7308 error and tried fixing it with react-native-git-upgrade and got this error.

Been having problems with it since last week. Any solutions. (a manual solution shouldn't be needed imo)

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Memory: 383.12 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.12.0 - /usr/local/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        Build Tools: 23.0.1, 23.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3
        API Levels: 23, 26, 27
    IDEs:
      Android Studio: 3.1 AI-173.4670197
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0
      react-native: 0.57.1 => 0.57.1
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
@kelset

This comment has been minimized.

Copy link
Collaborator

kelset commented Sep 24, 2018

a manual solution shouldn't be needed imo

Why? I never use react-native-git-upgrade whenever I update my projects, I prefer to do things manually to have granular control over the changes I apply 🤷‍♂️

Moreover, as discussed here, there is noone currently maintaining that portion of the CLI - so it's always a risk to use it.

@manosim

This comment has been minimized.

Copy link
Contributor

manosim commented Sep 26, 2018

I am also getting exactly the same error when running the tests on a fresh react-native 0.57.1 project. To reproduce:

Steps

react-native init TestProject
cd TestProject/
touch App.test.js

# Add this to App.test.js
# describe('hello', () => {
#   it('basic', () => {
#     expect(1+1).toEqual(2);
#   });
# });

yarn test

Output

$ jest --no-cache
 FAIL  ./App.test.js
  ● Test suite failed to run

    Couldn't find preset "module:metro-react-native-babel-preset" relative to directory "/Users/manos/Projects/TestProject"

      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
          at Array.map (<anonymous>)
      at OptionManager.resolvePresets (node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
      at OptionManager.mergePresets (node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
      at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
      at OptionManager.init (node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
      at File.initOptions (node_modules/babel-core/lib/transformation/file/index.js:212:65)
      at new File (node_modules/babel-core/lib/transformation/file/index.js:135:24)
      at Pipeline.transform (node_modules/babel-core/lib/transformation/pipeline.js:46:16)

Test Suites: 1 failed, 1 total

Worth mentioning that there is an open related issue on the metro repository: facebook/metro#242

Thought I should share it here since I can't see any activity around this issue.

@rottenoats

This comment has been minimized.

Copy link

rottenoats commented Sep 27, 2018

What solved my problem in the end, was simply building the project under Xcode and then running it with react-native run-ios.

If you're attempting to upgrade your project and you're stuck and unable to solve any problem, then this is what I did. Not the best way, but it works.

  1. Create a fresh project, with the lastest react-native version
  2. Run react-native run-ios, if it fails ensure to build it in xcode, abd then re-test it with react-native run-ios command
  3. Copy your source files into your project (not your iOS not your Android directories)
  4. Re-add all your dependencies (don't copy your package.json file)
  5. Run react-native link (if required)
  6. Add all required permissions in your Info.plist
  7. Repeat (2)
  8. Copy your .git into the project and create a new branch

If you're also building for Android, you'll need to reconfigure your Android project (manifest, build.gradle, etc)

If you run into some problems then you might have skipped a step or I might have forgotten to mention something.

I ran into a few issues, but that's because I forgot to add a few Babel plugins i was using for mobx.

This worked for me. Took a while, but in the end saved time instead of trying to understand vague error messages.

@luizvidoto

This comment has been minimized.

Copy link

luizvidoto commented Sep 27, 2018

Not so much related to this issue but I had another problem when trying to fresh install RN and maybe it could help someone.
I fresh installed RN using react-native-cli init and tried to run using run-ios command but build failed every time.
So I changed the Xcode project settings to use Legacy Build and then it worked. But the app didn't launch because it was giving me another error. The error was related to babel and I found a solution here: jquense/yup#216

@thomas-gilbert

This comment has been minimized.

Copy link

thomas-gilbert commented Sep 27, 2018

I am getting the same error, even when creating a brand new project with react-native init. All I changed from the base is -

  1. Moved tests to its own directory.
  2. Added one single test.
  3. Added babel-plugin-module-resolver

Please see the repo here - https://github.com/thomas-gilbert/react-native-metro-issue

React Native Environment Info:
System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 337.80 MB / 16.00 GB
Shell: 5.2 - /bin/zsh
Binaries:
Node: 9.4.0 - /usr/local/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.1, macOS 10.13, tvOS 11.1, watchOS 4.1
Android SDK:
Build Tools: 26.0.2, 27.0.1, 27.0.3
API Levels: 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 9.1/9B55 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.1 => 0.57.1
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-git-upgrade: 0.2.7

I have been going through quite a few different issues trying to resolve it and any change I make seems to show me another issue. Any help or insight would be appreciated.

@rottenoats

This comment has been minimized.

Copy link

rottenoats commented Sep 27, 2018

@thomas-gilbert did you open xcode and try building it from there?

@jacquesdev

This comment has been minimized.

Copy link

jacquesdev commented Sep 27, 2018

This solution started well #21241 (comment), it runs through the whole process and then complains about the error again and then rolls everything back.

@thomas-gilbert

This comment has been minimized.

Copy link

thomas-gilbert commented Sep 28, 2018

@rottenoats The issue isn't with the app building or bundling; as that works fine. I get the above issue only when running jest.

@SpQuyt

This comment has been minimized.

Copy link

SpQuyt commented Sep 28, 2018

You can try this:
Change the line of file ".babelrc":
from
{
"presets": ["module:metro-react-native-babel-preset"]
}
to
{
"presets": ["react-native"]
}

It worked for me.

@soh335

This comment has been minimized.

Copy link

soh335 commented Oct 3, 2018

current react-native-git-upgrade depend to babel6 (https://github.com/facebook/react-native/blob/master/react-native-git-upgrade/package.json). babel7 can handle module prefix (https://babeljs.io/docs/en/options#name-normalization) but I can't find this option on babel6 document. ( sorry I'm not good at babel ). Is this reason ?

@manosim

This comment has been minimized.

Copy link
Contributor

manosim commented Oct 4, 2018

Just tried with the fresh 0.57.2 and unfortunately, it looks like this is still happening on a fresh project. Steps to reproduce in my previous comment.

@rszalski

This comment has been minimized.

Copy link

rszalski commented Oct 5, 2018

@Amnesthesia 's workaround allowed my upgrade to progress a bit further, but eventually react-native-git-upgrade re-added the preset to .babelrc file and failed at the same error in the end.

My solution was to rename .babelrc -> .babelrc2 during upgrade which worked. I restored the .babelrc config after the upgrade.

Happened to me when upgrading v0.57.0 -> v0.57.1 and v0.57.1 -> v0.57.2.

@ryanhomer

This comment has been minimized.

Copy link

ryanhomer commented Dec 11, 2018

The various solutions lead to different results for me but I still haven't be able to make jest work properly. This is by far the most difficult RN upgrade to date due to the babel changes. Does anyone have any idea who is looking into this? Is it the RN, babel or jest team? It seems like we're all just locked in a room babbling to ourselves in isolation. 🙂

I would normally just wait but apparently RN 0.58.0 has a fix for the AAPT2 issue and we're trying to get this resolved since Google will soon not be allowing android.enableAapt2=false in gradle.properties.

WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018.

🌧 When it rains...

@yusufkaracin

This comment has been minimized.

Copy link

yusufkaracin commented Dec 11, 2018

@rszalski's solution worked for me;

  1. Create babel.config.js with the following content (basically equivalent to stock .babelrc)
module.exports = function (api) {
  api.cache(true)

  return {
    presets: ['module:metro-react-native-babel-preset']
  }
}
  1. Remove .babelrc
  2. Run yarn add --dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core

I didn't have to add any transforms to jest after that.

@ryanhomer

This comment has been minimized.

Copy link

ryanhomer commented Dec 13, 2018

The closest I've gotten to a working Jest with that configuration gives the following errors at various points during the tests:

  • ReferenceError: You are trying to import a file after the Jest environment has been torn down.
  • TypeError: Cannot read property 'default' of undefined
  • TypeError: stacktraceParser.parse is not a function

Additionally, it freezes during one of the tests and never completes. Also, there's nothing specific about the test it freezes on; if I remove that test, it'll get hung up on another.

I've been trying to get this resolved for weeks now. I don't know what else to try.

@clydedacruz

This comment has been minimized.

Copy link

clydedacruz commented Dec 14, 2018

adding the transform to my jest config in package.json fixed it for me

"jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.(js)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    }
  },
@nol13

This comment has been minimized.

Copy link

nol13 commented Dec 19, 2018

OK, current hopefully working solution after 55.3 > 57.8: @rszalski's babel.config.js

+

    "preset": "react-native",
    "transform": {
      "^.+\\.js$": "babel-jest"
    },

the transform only required for running tests from within webstorm, from command line the babel config works fine by itself

@dsandor

This comment has been minimized.

Copy link
Contributor

dsandor commented Jan 3, 2019

I just ran into this error message and found this thread. Just putting this here in case anyone else has a similar issue. I work on multiple projects under a ~/Projects folder structure like ~/Projects/react-app-foo and ~/Projects/some-node-app.

A few days ago I accidentally copied some of my .dotfiles from a react-native app into my ~/Projects folder. Suddenly my node app was throwing the Couldn't find preset.. error when running jest on my node project. Deleting the .babelrc from my parent folder fixed this for me. Hope it helps someone else.

@gutoglup

This comment has been minimized.

Copy link

gutoglup commented Jan 3, 2019

@dsandor but in this case I believe the problem is another. Because the problem reported in this topic is related to running the tests with Jest, and running the react-native project. I believe that the folder structure does not imply this error that is occurring, and the error logs that are being displayed.

@anubhavgupta

This comment has been minimized.

Copy link

anubhavgupta commented Jan 3, 2019

Adding "postinstall": "rm $( find node_modules -name .babelrc)" in the scripts section of package.json and then running npm install OR yarn fixes this issue for me.

@bobowork

This comment has been minimized.

Copy link

bobowork commented Jan 8, 2019

I seemed to have solved this by removing everything in the babelrc file:

# .babelrc
{
}

react-native-git-upgrade then tries to re-add this during installation. I kept removing it and re-saving the file, and it continued without crashing. Then I added the contents back.

Confirmed @Amnesthesia 's solution works.

@liangguohun

This comment has been minimized.

Copy link

liangguohun commented Jan 11, 2019

"jest": {
"preset": "react-native"//do not contain this line maybe can help
}

@methodbox

This comment has been minimized.

Copy link

methodbox commented Jan 13, 2019

I have also solved this by removing my .babelrc in the root (wasn't relevant anyway).

But it seems Expo is not handling this correctly. Shouldn't we be able to have localized Babel configuration in the root of the app?

Maybe this requires a configuration in the .expo?

@gutoglup

This comment has been minimized.

Copy link

gutoglup commented Jan 14, 2019

Adding "postinstall": "rm $( find node_modules -name .babelrc)" in the scripts section of package.json and then running npm install OR yarn fixes this issue for me.

"jest": {
"preset": "react-native"//do not contain this line maybe can help
}

I tried all the solutions presented, but there was success in none at the moment.
The Jest or React-Native team could speak on this case.

@arled

This comment has been minimized.

Copy link

arled commented Jan 14, 2019

Thank me later:

  "jest": {
    "preset": "react-native",
    "transform": { "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" }
  }
@gutoglup

This comment has been minimized.

Copy link

gutoglup commented Jan 14, 2019

Thank me later:

  "jest": {
    "preset": "react-native",
    "transform": { "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" }
  }

I've tried that too.
If you create a clean project, can you run some test with the jest using the renderer?

Because of what has already been explained, either you put the preset to react-native and run the tests, or you run the application with the module: react-native-babel-preset preset. If you try to put both of them up, it's the problem that the community mentioned earlier in this issue.

@beng970804

This comment has been minimized.

Copy link

beng970804 commented Jan 15, 2019

So, I can't do my testing by using Jest now right? Anyone have alternative way to do the testing on react native application?

@methodbox

This comment has been minimized.

Copy link

methodbox commented Jan 15, 2019

If you read this and related errors, you will notice that the directory it’s throwing the error from is inside node_modules.

A .babelrc will override in level of hierarchy other Babel configurations in subdirectories.

It would appear someone’s npm package is shipping with a .babelrc that presents a conflict when over-ridden.

This might also be another dot file in one of your project directories.

I would verify you don’t have another configuration file that might be read as a Babel config (I believe it accepts others than .babelrc)

As a test, try removing ALL dot files from your project (just move them if you need to save them), remove node_modules, then npm install again.

@Devil-Cong

This comment has been minimized.

Copy link

Devil-Cong commented Jan 21, 2019

I met the same situation.
I initialized a project with react-native-cli, then I integrated MboX and use decorators, so my package.json and .babelrc like this:

"dependencies": {
    "mobx": "^4.8.0",
    "mobx-react": "^5.4.3",
    "react": "16.6.0-alpha.8af6728",
    "react-native": "0.57.4"
},
"devDependencies": {
    "@babel/plugin-proposal-decorators": "^7.2.2",
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.49.1",
    "react-test-renderer": "16.6.0-alpha.8af6728"
}
{
    "presets": ["module:metro-react-native-babel-preset"],
    "plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy": true }]
    ]
}

When i run react-native-git-upgrade, i get this error:

git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". 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.

Then i try to remove the @babel/plugin-proposal-decorators plugin from .babelrc like this:

{
  "presets": ["module:metro-react-native-babel-preset"]
}

I get another error:

git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Couldn't find preset "module:metro-react-native-babel-preset" relative to directory...

Then i change .babelrc to babel.config.js:

module.exports = {
    presets: ['module:metro-react-native-babel-preset'],
    plugins: [
        ['@babel/plugin-proposal-decorators', { legacy: true }]
    ]
}

Run react-native-git-upgrade, it work!

I found that if I remove the .babelrc first and run react-native-git-upgrade, it also work!(need to put .babelrc back after upgraded.)

Hope this helps someone else.

@gutoglup

This comment has been minimized.

Copy link

gutoglup commented Jan 23, 2019

@Devil-Cong I did the test according to what you missed, it did not work either. Still giving the same problem.

@Devil-Cong

This comment has been minimized.

Copy link

Devil-Cong commented Jan 24, 2019

@gutoglup Sorry,but it work for me.
Did you try remove the .babelrc and run react-native-git-upgrade?

@Siva123Prasad

This comment has been minimized.

Copy link

Siva123Prasad commented Jan 24, 2019

When we try to run, this is what happens
bash: react-native-git-upgrade: command not found
@Devil-Cong

@Devil-Cong

This comment has been minimized.

Copy link

Devil-Cong commented Jan 24, 2019

@Siva123Prasad You should install react-native-git-upgrade first. Look at here.

@marhaupe

This comment has been minimized.

Copy link

marhaupe commented Jan 26, 2019

I experienced the same issue for a while now. Yesterday, jest released jest@24.0.0, which upgraded its internals to Babel 7. I upgraded my dependency to the following:

"jest": "24.0.0"
"babel-jest": "24.0.0"
"metro-react-native-babel-preset": "0.51.1"
while still being on "react-native": "0.57.8"

That solved my issues. I hope it works for some of you

@kelset

This comment has been minimized.

Copy link
Collaborator

kelset commented Jan 28, 2019

It seems that this issue was caused by incorrect upgrading - please refer to @Devil-Cong's comment above for a good step by step of how to avoid/fix the issue: #21241 (comment)

Closing & locking as that comment fixes it, and also we are working on improving the upgrading procedure

@kelset kelset closed this Jan 28, 2019

@facebook facebook locked as resolved and limited conversation to collaborators Jan 28, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.