Skip to content

create-react-app always throws babel error

Every time I create a create-react-app project it throws this error:

The react-scripts package provided by Create React App requires a dependency:

  "babel-loader": "8.0.4"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:

  /Users/dalegrant/Desktop/hyberchat-dashboard/client/node_modules/babel-loader (version: 8.0.5)

I have tried downgrading to 8.0.4,

I’ve tried installing 8.0.5

I’ve even made sure all my dependencies for babel rely on a 8.0.5!

I have no idea what to do from here as the error persists for every create react app I now build!

This must be a common problem, does anybody have an idea on how to get around this?!

Answer

In your machine user folder there is a node_modules directory and package-lock.json remove them using rm -rf User/node_modules and rm -rf User/package-lock.json after that delete node_module directory and pack-lock.json file in your project run npm install again then it’s works