when installing Babel, I encountered an Error: Cannot find module ‘@babel/core ‘. I checked a lot of materials before solving the problem. I hope I can help you brothers.
problem cause
problem cause
babel-loader and babel-core version do not correspond to generated,
babel-core x
babel-core as a way to make a new babel-core
NPM UN babel-core
NPM i-d @babel/core
NPM UN Babel – making of
NPM UN Babel -0
4, making of a new Babel
NPM I Babel/react
NPM I Babel -mobx
, uninstalling the old Babel -plugin
NPM UN babel-plugin-transform-runtime
6, install the new babel-plugin
NPM install –save-dev @babel/ plug-object-rest-spread
NPM install –save-dev @babel/ plug-object-rest-spread
NPM install –save-dev @babel/ plug-transform-runtime
NPM Install –save @babel/runtime
7, modify. Babelrc file
{
“presets” : [” @ Babel/preset – env “, “@ Babel/preset – react”, “mobx”],
“plugins” :
“@babel/ plugin-statement-object-rest-spread “,
“@babel/plugin-transform-runtime”
]
}
if you have finished the installation according to the above command, the corresponding version should be as shown below, and the problem should be solved.
“devDependencies” : {
“@ Babel/core” : “^” 7.2.2,
“@ Babel/plugin – proposal – object – the rest – spread” : “^ 7.2.0”,
“@ Babel/plugin – transform – runtime” : “^ 7.2.0,”
“@ Babel/preset – env” : “^ 7.2.3”,
“@ Babel/preset – react” : “^” 7.0.0,
“Babel – loader” : “^ 8.0.4”,
“Babel – preset – mobx” : “^ 2.0.0”,
“CSS – loader” : “^ 2.1.0,”
“file – loader” : “^” 3.0.1,
“popper. Js” : “^ 1.14.6”,
“style – loader” : “^ 0.23.1”,
“url – loader” : “^ 1.1.2”,
“webpack” : “^ 4.28.2”,
“webpack – cli” : “^ 3.1.2”
},
“dependencies” : {
“@ Babel/runtime” : “^ 7.2.0”,
“bootstrap” : “^ 2”,
“jquery” : “^ 3.3.1”
}
p>
Read More:
- Webpack — module build failed: error: the node API for ‘Babel’ has been moved to Babel core
- About the solution of error: cannot find module ‘@ Babel / core’
- How to Fix webpack Module build failed Error: The node API for ‘babel’ has been moved to babel-core
- Module build failed (from ./node_modules/babel-loader/lib/index.js) babel-loader
- [How to Fix] Cannot find module ‘babel-eslint‘
- [Solved] This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/@babel
- Solve angular’s cannot find module ‘@ angular devkit / core’ problem
- Error in entry module not found: error: can’t resolve ‘Babel loader’
- Module build failed: error:couldn’t find preset “env” relative to directory
- Error in Babel configuration of webpack
- ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- module ‘tensorflow_core._api.v2.train’ has no attribute ‘slice_input_producer’
- Module build failed: error: cannot find module ‘node sass’ error
- NPM- Cannot find module ‘xxxxx’
- Error: Cannot find module ‘process-nextick-args’
- Error: Cannot find module’webpack/bin/config-yargs’ solution
- django.core.exceptions . improveconfigured: error loading MySQL DB module. Django configuring MySQL database
- Error: cannot find module ‘mongoose’
- Error reported after moving or copying Vue items: cannot find module ‘xxx‘
- Node.js Cannot find module ‘mysql’ ‘express’