Error: Couldn't find preset "module:metro-react-native-babel-preset"
See original GitHub issueEnvironment
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:
- Created 5 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
rename .babelrc to something else, then run react-native-git-upgrade. After upgrading rename it back.
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.