Error: Cannot find module '@babel/core' in Reactjs
Hi everyone,
I have built a react application and today I pull from Github to my local computer but when building and running this project I got an error throw Error: Cannot find module '@babel/core'. Here is the full exception:
ERROR in ./src/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\conta\reactjs\project11\node_modules\babel-loader\lib\index.js:5:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
My app was installed Babel, Webpack. it's still working well for me before. I don't know why after cloning code from Github it didn't work for me.
Anyone can solve help me?
-
e0
exam prep Aug 10 2022
If your project still work before and didn't work after cloning code from Github. You need to rebuild and install all packages by running the command:
npm install
If it still does not work you can re-install babel by using the command:
npm install @babel/core --save
Hope this solution can solve this issue for you.
-
A0
AKHILESH CHAURASIYA Aug 10 2022
I try removing the existing babel by using the command:
npm uninstall babel-core babel-preset-env babel-preset-react
And try to reinstall them by using this command:
npm install --save-dev @babel/core @babel/preset-env @babel/preset-react
that works for me.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.