Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundling failed: Error: Plugin 0 provided an invalid property of "default"

I'm trying to run a react native app on my AVD using this command :

react-native run-android

but getting the following error:

 bundling failed: Error: Plugin 0 specified in "C:\\Users\\ASUS\\test\\node_modules\\babel-preset-react-native\\index.js" provided an invalid property of "default" (While processing preset: "C:\\Users\\ASUS\\test\\node_modules\\babel-preset-react-native\\index.js")
    at Plugin.init (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\plugin.js:131:13)
    at Function.normalisePlugin (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:152:12)
    at C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:184:30
    at Array.map (<anonymous>)
    at Function.normalisePlugins (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20)
    at OptionManager.mergeOptions (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36)
    at C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:14
    at C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:323:22
    at Array.map (<anonymous>)

.babelrc :

{
  "presets": [
    "react-native"
    "@babel/preset-flow"
  ]
}

package.json :

{
  "name": "test",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.4.1",
    "react-native": "^0.55.4"
  },
  "devDependencies": {
    "babel-jest": "23.4.0",
    "babel-preset-react-native": "5.0.2",
    "jest": "23.4.1",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

I'm using Windows , node.js v 8.11.3 & react native v 0.55.4

I've already tried everything recommended on internet(specially github) but still no luck. Really appreciate it if some one can help.

like image 438
Zainab Rostami Avatar asked Jul 22 '18 08:07

Zainab Rostami


3 Answers

This is bug in babel-preset-react-native

Set the version:

yarn remove babel-preset-react-native
yarn add [email protected]
like image 132
programmerJavaPL Avatar answered Sep 23 '22 06:09

programmerJavaPL


Well it may be late , but i will help other as below package.json is working till date 20.aug.2018

Below package.json most of dependencies like axios, Redux, Native base, react-native-router-flux ..etc used in react native projects, so version i mentioned below compatible to each other. Cheers.

{
  "name": "Example",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "resolutions": {
    "*/@babel/cli": "7.0.0-beta.54",
    "*/@babel/core": "7.0.0-beta.54",
    "*/@babel/code-frame": "7.0.0-beta.54"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "eslint": "^5.2.0",
    "native-base": "2.6.1",
    "prop-types": "^15.6.2",
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-router-flux": "^4.0.1",
    "react-native-timeline-listview": "^0.2.3",
    "react-navigation": "^2.11.2",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.5.0",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }

}
like image 21
Abhishek Garg Avatar answered Sep 21 '22 06:09

Abhishek Garg


I had this issue, I needed to downgrade babel-preset-react-native version.

If you use yarn

yarn remove babel-preset-react-native
yarn add [email protected]

or use npm commands

npm uninstall babel-preset-react-native
npm install [email protected]
like image 38
Khemraj Sharma Avatar answered Sep 21 '22 06:09

Khemraj Sharma