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

I want to let the backend node run es6 through babel-node. As a result, after installing babel-cli, I always report Requires Babel "^ 7.0.0-0" and but was loaded with "6.26.3". The details are as follows:

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.
    at throwVersionError (/Users/apple/HBuilderXProjects/travel-house/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
    at Object.assertVersion (/Users/apple/HBuilderXProjects/travel-house/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
    at _default (/Users/apple/HBuilderXProjects/travel-house/node_modules/@babel/plugin-proposal-decorators/lib/index.js:43:7)
    at /Users/apple/HBuilderXProjects/travel-house/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at Function.memoisePluginContainer (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:113:13)
    at Function.normalisePlugin (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:146:32)
    at /Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at compile (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/lib/node.js:103:45)
    at loader (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/lib/node.js:144:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at Object.<anonymous> (/Users/apple/HBuilderXProjects/travel-house/node_modules/babel-cli/lib/_babel-node.js:154:22)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)

my package.json configuration is as follows

 "dependencies": {
    "@babel/cli": "^7.2.3",
    "@babel/helper-plugin-utils": "^7.0.0",
    "@babel/runtime": "^7.2.0",
    "@svgr/webpack": "2.4.1",
    "antd": "^3.12.1",
    "babel-cli": "^6.26.0",
    "babel-eslint": "9.0.0",
    "babel-jest": "^23.6.0",
    "babel-loader": "8.0.4",
    "babel-plugin-import": "^1.8.0",
    "babel-plugin-named-asset-import": "^0.3.0",
    "babel-preset-react-app": "^7.0.0",
    "bfj": "6.1.1",
    ...
  },
"devDependencies": {
    "@babel/core": "^7.2.2",
    "@babel/plugin-proposal-decorators": "^7.2.3",
    "@babel/preset-env": "^7.2.3",
    "babel-core": "^7.0.0-bridge.0",
    "babel-plugin-import": "^1.11.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "jest": "^23.6.0"
  }

I have been messing around for hours, trying everything I can try on the Internet, but this is still the wrong report! Please help the gods!

Apr.20,2022

The answer adopted by

does say the solution, but it is very vague. I also encountered this problem, which took more than half a genius to solve. Let me explain.
however, the subject introduced a bunch of conflicts in order to solve the problem, in which case all babel related dependencies should be removed first.
install babel-cli default installation depends on babel/core 6.26.3 , it can be said that this syntax without @ will stay in V6 version.
so if you want to use v7, you should use @ babel/cli to provide a babel command line environment. This version does not automatically install @ babel/core , but needs to install its own matching dependencies, so to be able to execute babel and enable node to run the new JavaScript features, the minimum installation is:

yarn add @babel/cli @babel/core @babel/node @babel/preset-env -D

delete everything under the node_modules folder and re-npm install it

in addition, "babel-cli": "^ 6.26.0" does this line conflict

to see the specific version number, you can go to package-lock.json, or if you use yarn, go to yarn-lock.json.


your dependencies include both babel-cli and @ babel/cli, and both babel-cor and @ babel/core, which may cause conflicts. It is best to make sure that you can install one.


  1. npm I-g @ babel/core @ babel/node

run babel-node in the following ways

npx babel-node youself.js

my solution before reinstalling babel-loader is that 8.x is available after 7.x reinstallation

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea21e4-1ba9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea21e4-1ba9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?