How to fix the Cannot find module '@babel/core' error
In this tutorial, we are going to learn about how to fix the Cannot find module ‘@babel/core’ error.
When we run a project using npm start, sometimes we see the following error in our terminal.
ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module '@babel/core'
It occurs due to the package name is changed from
To fix the error, we can install the
@babel/core module by running the following command.
npm i -D @babel/core
If your still facing the issue even after installing the
@babel/core module follow the below steps to fix it.
- First, remove the
package-lock.jsonfile present inside your project directory by using the below command.
rm-rf node_modules rm-rf package-lock.json
or you can remove it manually by right-clicking on it and select the
- Clear the npm cache.
npm clean cache --force
- Re-install the node modules again by running the