踩坑记录:安装babel运行webpack项目出错的解决方案

2019-10-26  本文已影响0人  我是何宝荣呀

今天晚上在安装babel的时候,去运行项目一直在报错,然后在网上查了一下资料
,发现解决方案是运行一次下面这个命令~~~
下面长代码就是报错的代码,亲测有用~
cnpm i babel-loader@7 -D

ERROR in ./src/main.js
Module build failed (from ./node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\babel-preset-stage-0\lib\index.js
    at createDescriptor (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-descriptors.js:178:11)
    at items.map (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-descriptors.js:109:29)
    at createPresetDescriptors (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-descriptors.js:101:10)
    at presets (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-descriptors.js:47:19)
    at mergeChainOpts (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-chain.js:315:26)
    at D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-chain.js:278:7
    at buildRootChain (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\config-chain.js:118:22)
    at loadPrivatePartialConfig (D:\personalFile\myStudy\webLearn\works\webpack_1\node_modules\_@babel_core@7.0.0@@babel\core\lib\config\partial.js:57:55)
上一篇 下一篇

猜你喜欢

热点阅读