Reputation: 385
I get this error for every Jest test suite I run:
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.
But what is strange, this error appears only if I try to install packages via npm install
. So what is the problem? What I do wrong?
P.S. I don't want to use yarn install
.
Here is my paskage.json
s babel, jest and enzyme related parts:
{
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.4",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-proposal-decorators": "^7.2.3",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-flow": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-loader": "8.0.4",
"babel-plugin-react-docgen": "^2.0.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"jest": "^23.6.0",
"jest-enzyme": "^7.0.1",
"jest-pnp-resolver": "1.0.1",
"jest-resolve": "23.6.0",
},
}
Upvotes: 0
Views: 1811
Reputation: 308
Jest 23 does not support @babel/core 7. Either upgrade to Jest 24 which supports babel 7 or run
npm install --save-dev [email protected]
to load a compatible version of babel for jest 23
Upvotes: 1