babel 安裝錯誤
因為博主在學(xué)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)
可能是由于版本的問題缆八,導(dǎo)致項目啟動時失敗胞谭,最開始安裝了高版本的babel-loader 恨溜,但是對應(yīng)的babel-core 版本過低符衔,后來我把舊版本的babel-core 卸載,安裝高版本的babel后依舊提示錯誤糟袁,并且卸載時失敗判族,到發(fā)帖時為止,問題尚未解決..