0
votes

I've already tried a lot of solutions given by the Github community about this matter, but none seems to work for me.

/node_modules/react-xml-parser/dist/bundle.js: 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. (While processing preset: "/Users/Brenor2/Documents/Freelas/ReiDasLiganetes/proj_ecommerce_reidasliganetes/mstore-expo/node_modules/@babel/preset-env/lib/index.js")

Below is my package.json file:

  {
"name": "mstore",
"description": "MStore Pro - Complete React Native template for e-commerce",
"author": "InpireUI",
"version": "3.5.0",
"private": true,
"main": "node_modules/expo/AppEntry.js",
"scripts": {
  "setup": "./scripts/setup.sh"
},
"dependencies": {
  "@babel/core": "^7.0.0-beta.50",
  "api-ecommerce": "^0.0.5",
  "babel-plugin-transform-decorators-legacy": "^1.3.5",
  "base-64": "^0.1.0",
  "blob": "0.0.5",
  "currency-formatter": "^1.4.2",
  "datejs": "^1.0.0-rc3",
  "expo": "27.0.1",
  "firebase": "^5.0.1",
  "html-entities": "^1.2.1",
  "lodash": "4.17.10",
  "lottie-react-native": "^2.5.11",
  "moment": "^2.22.2",
  "monet": "^0.8.10",
  "oauth-1.0a": "1.0.1",
  "react": "16.4.1",
  "react-instantsearch": "^5.1.0",
  "react-native": "https://github.com/expo/react-native/archive/sdk-28.0.0.tar.gz",
  "react-native-animatable": "^1.3.0",
  "react-native-app-intro-slider": "^0.2.4",
  "react-native-awesome-alerts": "^1.2.0",
  "react-native-banner-carousel": "^1.0.3",
  "react-native-chart-kit": "^1.1.5",
  "react-native-collapsible": "0.12.0",
  "react-native-drawer": "https://github.com/luyx2412/react-native-drawer.git",
  "react-native-elements": "^0.19.1",
  "react-native-modal": "^7.0.2",
  "react-native-modalbox": "1.5.0",
  "react-native-parallax": "^0.3.0",
  "react-native-pure-chart": "0.0.24",
  "react-native-radio-buttons": "^1.0.0",
  "react-native-render-html": "3.10.0",
  "react-native-responsive-dimensions": "^1.0.2",
  "react-native-scrollable-tab-view": "^0.8.0",
  "react-native-side-menu": "^1.1.3",
  "react-native-snap-carousel": "^3.7.5",
  "react-native-star-rating": "^1.0.9",
  "react-native-swipe-list-view": "1.3.0",
  "react-native-swiper": "^1.5.13",
  "react-native-ui-kitten": "^3.1.2",
  "react-native-vector-icons": "4.6.0",
  "react-navigation": "2.5.5",
  "react-redux": "5.0.7",
  "react-xml-parser": "^1.0.8",
  "redux": "^4.0.0",
  "redux-persist": "^5.9.1",
  "redux-thunk": "^2.3.0",
  "reselect": "^3.0.1",
  "tcomb-form-native": "^0.6.13",
  "urijs": "1.19.1",
  "url": "^0.11.0",
  "url-parse": "1.4.1",
  "util": "0.11.0",
  "uuid": "3.3.2",
  "validate.js": "^0.12.0",
  "wpapi": "^1.1.2"
},
"devDependencies": {
  "@babel/core": "^7.4.0",
  "@babel/preset-env": "^7.4.1",
  "babel-core": "^7.0.0-bridge.0",
  "babel-jest": "^23.0.1",
  "babel-loader": "^8.0.5",
  "babel-plugin-transform-remove-console": "^6.9.4",
  "babel-preset-react-native": "4.0.0",
  "eslint": "^5.5.0",
  "eslint-config-airbnb": "^17.1.0",
  "eslint-config-google": "^0.9.1",
  "eslint-plugin-import": "^2.14.0",
  "eslint-plugin-jsx-a11y": "^6.1.1",
  "eslint-plugin-react": "^7.11.1",
  "jest": "^23.1.0",
  "react-test-renderer": "^16.4.0",
  "reactotron-react-native": "^1.14.0",
  "reactotron-redux": "^1.13.0",
  "webpack": "^4.29.6"
},  
"resolutions": {
  "babel-core": "7.0.0-bridge.0"
}

}

Here is the .babelrc file of the package react-xml-parser that is throwing the error (I had to manually change the file from "env" to "preset-env"):

{ "presets": ["@babel/preset-env"] }
3
babel-plugin-transform-decorators-legacy is for Babel 6.connexo

3 Answers

2
votes

babel-plugin-transform-decorators-legacy is for Babel 6.

Instead, use @babel/plugin-proposal-decorators and update your .babelrc:

{
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
  ]
}
1
votes

https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy

You need to use ["@babel/plugin-proposal-decorators", { "legacy": true }] with babel7.

Most of the packages for babel7 are renamed from babel-whatever-* to @babel/whatever-*

0
votes

Finally I solved my question downgrading the react-xml-parser (the package that was causing the error) to an older version and it worked. It makes sense because this error started after a update that I made of all packages.