webpack中配置babel时遇到的问题

Error: Cannot find module '@babel/core' babel-loader@8 requires Babel 7.x (the package '@babel/core'). If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'.

npm install -D babel-loader @babel/core @babel/preset-env webpack

提示错误信息:

源文本中存在无法识别的标记。
所在位置 行:1 字符: 29

  • npm install -D babel-loader <<<< @babel/core @babel/preset-env webpack
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : UnrecognizedToken

在cmd命令窗口输入

npm install -D babel-loader @babel/core @babel/preset-env webpack

可正常运行

babel-loader:官网地址
参考资料:https://www.cnblogs.com/soyxiaobi/p/9554565.html

猜你喜欢

转载自www.cnblogs.com/songsongblue/p/11886325.html