Requires Babel "^7.0.0-0", but was loaded with "6.26.3"
See original GitHub issue🐛 Bug Report
Followed the instructions on the jest website to install babel-core to work with Babel7, and also looked at #6662 but nothing seems to help.
The following is the Stacktrace
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 (node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
at Object.assertVersion (node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
at _default (node_modules/@babel/plugin-transform-runtime/lib/index.js:82:7)
at node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
at Array.map (<anonymous>)
My package.json looks like this
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.1",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "^8.0.0",
"jest": "^23.4.1",
"jest-cli": "^23.4.1",
"jest-trx-results-processor": "^0.0.7"
},
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@babel/runtime": "^7.0.0",
"babel-plugin-add-module-exports": "^0.2.1"
}
My .babelrc
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"ie": 11
},
"useBuiltIns": "usage"
}
],
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-object-assign"
]
}
Run npx envinfo --preset jest
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
Binaries:
Node: 10.10.0 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
npmPackages:
jest: ^23.4.1 => 23.6.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Requires Babel "7.0.0-0" but was loaded with "6.26.3"
Test which version you are running with cmd babel -V. If it is not verion 7 or higher npm uninstall babel-cli -g npm...
Read more >Requires Babel “7.0.0-0” but was loaded with “6.26.3” - GitHub
In a test setup.js file, I was importing babel-register instead of @babel/register . If you feel like your dependencies are updated, ...
Read more >Requires Babel "^7.0.0-0", but was loaded with "6.26.3"
I'm facing the below build issue. Some of dependencies has babel 6 and some has babel 7. But, when a dependency requires babel...
Read more >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...
Read more >Error_ Requires Babel _^7.0.0-0_, but was loaded ... - 博客园
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, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
rimraf node_modules rimraf package-lock.json
"resolutions": { "babel-core": "7.0.0-bridge.0" },
in package.jsoninstall by yarn,it works.
You don’t need resolutions, see example https://github.com/facebook/jest/tree/master/examples/babel-7
You’re missing
babel-jest
dependency. You might needbabel.config.js
instead of.babelrc
depending in your repoPlease note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.