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'.

2019-08-26 发表在 编程语言 181

webpack报错

错误信息如下:

 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:625:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js:10:11)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at loadLoader (/Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_loader-runner@2.4.0@loader-runner/lib/loadLoader.js:18:17)
    at iteratePitchingLoaders (/Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_loader-runner@2.4.0@loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_loader-runner@2.4.0@loader-runner/lib/LoaderRunner.js:365:2)
    at NormalModule.doBuild (/Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack@4.39.2@webpack/lib/NormalModule.js:292:3)
    at NormalModule.build (/Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack@4.39.2@webpack/lib/NormalModule.js:438:15)

ERROR in ./node_modules/_webpack-dev-server@3.8.0@webpack-dev-server/client?http://localhost:8080
Module build failed (from ./node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
Require stack:
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_loader-runner@2.4.0@loader-runner/lib/loadLoader.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_loader-runner@2.4.0@loader-runner/lib/LoaderRunner.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack@4.39.2@webpack/lib/NormalModule.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack@4.39.2@webpack/lib/NormalModuleFactory.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack@4.39.2@webpack/lib/Compiler.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack@4.39.2@webpack/lib/webpack.js
- /Users/panjing/WebstormProjects/12apm-nodejs/node_modules/_webpack-dev-server@3.8.0@webpack-dev-server/bin/webpack-dev-server.js
 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  babel-loader@7 --save-dev
作者:贝塔博客
本站使用「署名 4.0 国际」创作共享协议,转载请在文章明显位置注明作者及出处。
评论
登录以后才可以发布评论哦, 点击登录 发布评论
评论列表 0人参与,0条评论
暂时还没有人评论,快来一条神回复吧!