I have a react js application running in React 17 with Node 14 version. And it is legacy application on react-scripts version "4.0.3". Everything was fine until Aug 08 where during npm build started to fail with the following:
Requires Babel "^7.16.0", but was l oaded with "7.12.3". If you are sure you have a compatible version of u/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 c alling Babel. (While processing: "node_modulesbabel-pre set-react-appindex.js$0$2")
On same day I saw couple of posts over internet like the below one:
https://dev.to/jitendra_singh_428933c91c/babel-7160-but-was-loaded-with-7123-1iaa. But there are no proper solutions attached to it. Any help is much appreciated.
I am trying to build my react application using npm run build with inbuild webpacks of react-scripts.
2
Answers
Resolved with downgrading caniuse-lite as babel had upgraded to latest versions.
"caniuse-lite": "1.0.30001632"
Place the following in package.json depending on what you use yarn or npm for installation.
For npm
For yarn
Upgrade react-scripts from 4.0.3 -> 5.0.1