当前位置:   article > 正文

关于安装babel时出现的错误以及解决办法_you should install 'babel-loader@7

you should install 'babel-loader@7

在开始接触到react之初,安装babel插件是一件必须要做的事情,但是我在安装的时候,出现了一个错误,这个错误刚开始很头疼,在网上找了各种解决的办法,但是一直不行,直到今天,也就是解决安装错误的第三天,临近崩溃的我,安装成功了,首先来看下错误。

ERROR in ./src/index.js
Module build failed (from ./node_modules/_babel-loader@8.0.5@babel-loader/lib/index.js):
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'.
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\project\React\1react-webpack\node_modules\_babel-loader@8.0.5@babel-loader\lib\index.js:10:11)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

解决办法,加上

cnpm i babel-loader@7 -D
  • 1

然后按照正常步骤安装。
我的安装步骤详见https://blog.csdn.net/zhuhui2000

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/450802
推荐阅读
相关标签
  

闽ICP备14008679号