请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Requires Babel "^7.0.0-0", but was loaded with "6.26.3"

Error: 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.

{
“name”: “react-app”,
“version”: “0.1.0”,
“private”: true,
“dependencies”: {
"@babel/core": “^7.0.0”,
“babel-core”: “^7.0.0-bridge.0”,
"@svgr/webpack": “2.4.1”,
“antd-mobile”: “^2.2.0-beta.1”,
“axios”: “^0.18.0”,
“babel-eslint”: “9.0.0”,
“babel-jest”: “23.6.0”,
“babel-loader”: “8.0.4”,
“babel-plugin-named-asset-import”: “^0.3.0”,
“babel-preset-react-app”: “^7.0.0”,
“bfj”: “6.1.1”,
“body-parser”: “^1.18.3”,
“browser-cookies”: “^1.2.0”,
“case-sensitive-paths-webpack-plugin”: “2.1.2”,
“chalk”: “2.4.1”,
“cookie-parser”: “^1.4.3”,
“css-loader”: “1.0.0”,
“dotenv”: “6.0.0”,
“dotenv-expand”: “4.2.0”,
“eslint”: “5.6.0”,
“eslint-config-react-app”: “^3.0.6”,
“eslint-loader”: “2.1.1”,
“eslint-plugin-flowtype”: “2.50.1”,
“eslint-plugin-import”: “2.14.0”,
“eslint-plugin-jsx-a11y”: “6.1.2”,
“eslint-plugin-react”: “7.11.1”,
“express”: “^4.16.4”,
“file-loader”: “2.0.0”,
“fork-ts-checker-webpack-plugin-alt”: “0.4.14”,
“fs-extra”: “7.0.0”,
“html-webpack-plugin”: “4.0.0-alpha.2”,
“identity-obj-proxy”: “3.0.0”,
“jest”: “23.6.0”,
“jest-pnp-resolver”: “1.0.1”,
“jest-resolve”: “23.6.0”,
“mini-css-extract-plugin”: “0.4.3”,
“mongoose”: “^5.4.1”,
“optimize-css-assets-webpack-plugin”: “5.0.1”,
“pnp-webpack-plugin”: “1.1.0”,
“postcss-flexbugs-fixes”: “4.1.0”,
“postcss-loader”: “3.0.0”,
“postcss-preset-env”: “6.3.1”,
“postcss-safe-parser”: “4.0.1”,
“rc-queue-anim”: “^1.6.11”,
“react”: “^16.7.0”,
“react-app-polyfill”: “^0.2.0”,
“react-dev-utils”: “^7.0.0”,
“react-dom”: “^16.7.0”,
“react-redux”: “^6.0.0”,
“react-router-dom”: “^4.3.1”,
“redux”: “^4.0.1”,
“redux-thunk”: “^2.3.0”,
“resolve”: “1.8.1”,
“sass-loader”: “7.1.0”,
socket.io”: “^2.2.0”,
“socket.io-client”: “^2.2.0”,
“style-loader”: “0.23.0”,
“terser-webpack-plugin”: “1.1.0”,
“url-loader”: “1.1.1”,
“utility”: “^1.15.0”,
“webpack”: “4.19.1”,
“webpack-dev-server”: “3.1.9”,
“webpack-manifest-plugin”: “2.0.4”,
“workbox-webpack-plugin”: “3.6.3”
},
“scripts”: {
“start”: “node scripts/start.js”,
“build”: “node scripts/build.js”,
“test”: “node scripts/test.js”,
“server”: “NODE_ENV=test nodemon --exec babel-node server/server.js”
},
“eslintConfig”: {
“extends”: “react-app”,
“rules”: {
“eqeqeq”: [
0
]
}
},
“browserslist”: [
">0.2%",
“not dead”,
“not ie <= 11”,
“not op_mini all”
],
“devDependencies”: {
“babel-cli”: “^6.26.0”,
“babel-plugin-import”: “^1.11.0”,
“babel-plugin-transform-decorators-legacy”: “^1.3.5”
},
“jest”: {
“collectCoverageFrom”: [
“src//*.{js,jsx,ts,tsx}",
"!src/
/.d.ts"
],
“resolver”: “jest-pnp-resolver”,
“setupFiles”: [
“react-app-polyfill/jsdom”
],
“testMatch”: [
"/src//tests//
.{js,jsx,ts,tsx}”,
"/src/**/?(.)(spec|test).{js,jsx,ts,tsx}"
],
“testEnvironment”: “jsdom”,
“testURL”: “http://localhost”,
“transform”: {
"^.+\.(js|jsx|ts|tsx)KaTeX parse error: Expected 'EOF', got '\\' at position 51: …st", "^.+\̲\̲.css": “/config/jest/cssTransform.js”,
"^(?!.
\.(js|jsx|ts|tsx|css|json)KaTeX parse error: Expected 'EOF', got '}' at position 50: …nsform.js" }̲, "transfor…",
"^.+\.module\.(css|sass|scss)KaTeX parse error: Expected '}', got 'EOF' at end of input: … "^react-native": “react-native-web”,
"^.+\.module\.(css|sass|scss)$": “identity-obj-proxy”
},
“moduleFileExtensions”: [
“web.js”,
“js”,
“web.ts”,
“ts”,
“web.tsx”,
“tsx”,
“json”,
“web.jsx”,
“jsx”,
“node”
]
},
“resolutions”: {
“babel-core”: “7.0.0-bridge.0”
},
“babel”: {
“presets”: [
“react-app”
],
“plugins”: [
[
“import”,
{
“libraryName”: “antd-mobile”,
“style”: “css”
}
],
[
"@babel/plugin-proposal-decorators",
{
“legacy”: true
}
]
]
},
“proxy”: “http://localhost:9093
}

网上的解决方法都用遍了还是不行,求解

正在回答 回答被采纳积分+3

1回答

提问者 阿常先森 2019-02-20 16:50:12

解决了:

dependencies 里面添加

"babel-core": "^7.0.0-bridge.0",

"regenerator-runtime": "^0.13.1",


但是不知道为什么,console里面报的是babel版本低,可是升级之后还是报上面那个错。添加了这个regenerator-runtime才好的。


1 回复 有任何疑惑可以回复我~
  • chenxyu #1
    我这样没有解决问题,去官方文档查了一下
    npm install --save-dev @babel/core @babel/cli @babel/node
    之后就好了
    我还安装了 babel-cli@next
    总之完全升级之后,就解决问题了
    回复 有任何疑惑可以回复我~ 2019-04-19 22:28:29
问题已解决,确定采纳
还有疑问,暂不采纳
Redux+React Router+Node.js全栈开发
  • 参与学习       1822    人
  • 解答问题       750    个

全网唯一的React 16+Redux+React Router4实战课程,学到手是你的真本领!

了解课程
意见反馈 帮助中心 APP下载
官方微信