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'.
webpack报错
错误信息如下:
shell
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'.
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'.
解决办法
shell
npm install babel-loader@7 --save-dev
npm install babel-loader@7 --save-dev