繁体   English   中英

需要Babel“ ^ 7.0.0-0”,但在react-xml-parser软件包中已加载“ 6.26.3”-已经尝试了所有当前解决方案

[英]Requires Babel “^7.0.0-0”, but was loaded with “6.26.3” on a react-xml-parser package - already tried all the current solutions

我已经尝试过Github社区针对此问题提供的许多解决方案,但似乎没有一个对我有用。

/node_modules/react-xml-parser/dist/bundle.js:需要Babel“ ^ 7.0.0-0”,但已加载“ 6.26.3”。 如果您确定拥有@ babel / core的兼容版本,则可能是您的构建过程中正在加载错误的版本。 检查此错误的堆栈跟踪,以查找第一个未提及“ @ babel / core”或“ babel-core”的条目,以了解正在调用的Babel。 (同时处理预设:“ / Users/Brenor2/Documents/Freelas/ReiDasLiganetes/proj_ecommerce_reidasliganetes/mstore-expo/node_modules/@babel/preset-env/lib/index.js”)

以下是我的package.json文件:

  {
"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"
}

}

这是引发错误的包react-xml-parser的.babelrc文件(我必须手动将文件从“ env”更改为“ preset-env”):

{ "presets": ["@babel/preset-env"] }

babel-plugin-transform-decorators-legacy适用于Babel 6。

相反,请使用@babel/plugin-proposal-decorators并更新.babelrc

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

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

您需要对babel7使用["@babel/plugin-proposal-decorators", { "legacy": true }]

babel7的大多数软件包都从babel-whatever-*重命名为@babel/whatever-*

最后,我解决了将我的react-xml-parser(导致错误的包)降级到较旧版本的问题,并且可以正常工作。 这是有道理的,因为此错误是在我对所有软件包进行的更新之后开始的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM