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:
- Module build failed (from ./node_modules/babel-loader/lib/index.js) babel-loader
- Webpack — module build failed: error: the node API for ‘Babel’ has been moved to Babel core
- How to Fix webpack Module build failed Error: The node API for ‘babel’ has been moved to babel-core
- Gulp failed to run
- Module build failed Error Plugin/Preset files are not allowed to export objects, only functions (How to Fix)
- Elememt UI introduces components on demand to report errors
- Module build failed: error:couldn’t find preset “env” relative to directory
- Module build failed: SyntaxError: Unexpected token
- Webpack error module build failed: typeerror: fileSystem.statSync is not a function
- About the solution of error: cannot find module ‘@ Babel / core’
- UnhandledPromiseRejectionWarning Error: Can‘t set headers after they are sent (How to Fix)
- Error in Babel configuration of webpack
- Syntax error in Vue ie10 browser
- Error in created hook: “referenceerror:” promise “undefined” Vue cli project Google is right, ie reported an error, “promise” undefined“
- package.json And package- clock.json The difference between
- Front end project runtime prompts syntax error: typeerror: token.type.endswith is not a function solution
- Webpack multi version incompatibility error
- ERROR in static/js/app.xxxxxxx.js from UglifyJs Unexpected token: operator (>)
- After NPM run dev is running, the browser does not respond and reports an error in. / ~ / Babel loader / lib! / ~ / Vue loader / lib/ selector.js?type=script&in
- Solution: ‘import’ and ‘export’ may appear only with ‘sourcetype: module’