question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Environment

Environment: OS: macOS High Sierra 10.13.6 Node: 10.11.0 Yarn: 1.9.4 npm: 6.4.1 Watchman: 4.9.0 Xcode: Xcode 10.0 Build version 10A255 Android Studio: 3.2 AI-181.5540.7.32.5014246

Packages: (wanted => installed) react: 16.6.0 => 16.6.0 react-native: 0.51.0 => 0.51.0

Description

When I was trying to recreate news ios and android folders. It throw a error as bellow:


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/my_usr/Downloads/myproject/app"
    at /usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
    at Array.map (<anonymous>)
    at OptionManager.resolvePresets (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
    at OptionManager.init (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-register/lib/node.js:103:45)
    at loader (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
git-upgrade ERR! Restore initial sources

Reproducible Demo

“dependencies”: { “moment”: “^2.22.2”, “prop-types”: “15.6.2”, “react”: “16.6.0”, “react-native”: “0.51.0”, “react-navigation”: “2.5.3”, “underscore.string”: “3.3.4” },

BY RUNNING command react-native-git-upgrade 0.51.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

20reactions
tavrezcommented, Oct 31, 2018

rename .babelrc to something else, then run react-native-git-upgrade. After upgrading rename it back.

2reactions
react-native-botcommented, Oct 30, 2018

It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

The “⏪Old Version” label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Couldn't find preset "module:metro-react-native-babel ...
An error occurred during upgrade: Error: Couldn't find preset "module:metro-react-native-babel-preset" relative to directory "Users/.
Read more >
Couldn't find preset "module:metro-react-native-babel-preset ...
I'm trying to run my test suite but I am getting the following error: Couldn ...
Read more >
metro-react-native-babel-preset - npm
Babel presets for React Native applications. React Native itself uses this Babel preset by default when transforming your app's source code. If ...
Read more >
babel/preset-react
When spreading props, use inline object with spread elements directly instead of Babel's extend helper or Object.assign . .babelrc.js. module.exports = { ...
Read more >
jest报错Couldn't find preset "module:metro ... - CodeAntenna
使用react-native时,用jest报错Couldn't find preset "module:metro-react-native-babel-preset" relative to directory。 1.执行npm i babel-preset-react-native ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found