babel 安装错误
因为博主在学webpack,但是webpack没法打包ES6及以上版本的JavaScript代码,所以需要第三方解析器,所以开始在项目中安装babel,但是遇到了错误,以下是错误提示,求解决呀~~~~
Error: Module build failed (from ./node_modules/_babel-loader@7.1.5@babel-loader/lib/index.js):
Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.
at throwVersionError (G:\vue\vue-study\node_modules\_@babel_helper-plugin-utils@7.0.0@@babel\helper-plugin-utils\lib\index.js:65:11)
at Object.assertVersion (G:\vue\vue-study\node_modules\_@babel_helper-plugin-utils@7.0.0@@babel\helper-plugin-utils\lib\index.js:13:11)
at _default (G:\vue\vue-study\node_modules\_@babel_plugin-proposal-object-rest-spread@7.4.4@@babel\plugin-proposal-object-rest-spread\lib\index.js:51:7)
at G:\vue\vue-study\node_modules\_@babel_helper-plugin-utils@7.0.0@@babel\helper-plugin-utils\lib\index.js:19:12
at Function.memoisePluginContainer (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:113:13)
at Function.normalisePlugin (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:146:32)
at G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:158:20)
at OptionManager.mergeOptions (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:234:36)
at OptionManager.init (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\index.js:212:65)
at new File (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (G:\vue\vue-study\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\pipeline.js:46:16)
at transpile (G:\vue\vue-study\node_modules\_babel-loader@7.1.5@babel-loader\lib\index.js:50:20)
at Object.module.exports (G:\vue\vue-study\node_modules\_babel-loader@7.1.5@babel-loader\lib\index.js:173:20)
可能是由于版本的问题,导致项目启动时失败,最开始安装了高版本的babel-loader ,但是对应的babel-core 版本过低,后来我把旧版本的babel-core 卸载,安装高版本的babel后依旧提示错误,并且卸载时失败,到发帖时为止,问题尚未解决..
网友评论