2
respostas

Erro ao executar npm build dev

ERROR in ./app-src/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/core'
Require stack:
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\babel-loader\lib\index.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\loader-runner\lib\loadLoader.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\loader-runner\lib\LoaderRunner.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModule.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModuleFactory.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compiler.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\webpack.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack-cli\bin\utils\validate-options.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack-cli\bin\utils\convert-argv.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack-cli\bin\cli.js
- E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\bin\webpack.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'.
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
    at Object.<anonymous> (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\babel-loader\lib\index.js:10:11)
    at Module._compile (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
    at loadLoader (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\loader-runner\lib\loadLoader.js:18:17)
    at iteratePitchingLoaders (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\loader-runner\lib\LoaderRunner.js:169:2)
    at runLoaders (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\loader-runner\lib\LoaderRunner.js:365:2)
    at NormalModule.doBuild (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModule.js:295:3)
    at NormalModule.build (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModule.js:446:15)
    at Compilation.buildModule (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:739:10)
    at E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:1111:12
    at E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModuleFactory.js:409:6
    at E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModuleFactory.js:155:13
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesWaterfallHook.lazyCompileHook (E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Hook.js:154:20)
    at E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModuleFactory.js:138:29
    at E:\DOWNLOADS\Cursos\Alura\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\NormalModuleFactor
2 respostas

Busquei no forum mas não encontrei nenhuma dúvida parecida.

Roberto, boa tarde!

Para versões do babel <7, você pode rodar o comando

npm install --save-dev babel-core babel-preset-env

Para versões >=7 use:

npm install --save-dev @babel/core @babel/preset-env

Espero ter ajudado e bons estudos!