Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

Erro1

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client>npm run build-dev

client@1.0.0 build-dev C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client webpack --config webpack.config.js

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:188 chunk.sortModules(); ^

TypeError: chunk.sortModules is not a function at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:188:19 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:3110:16 at eachOfArrayLike (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:1069:9) at eachOf (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:1117:5) at Object.eachLimit (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:3172:5) at Compilation. (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:184:27) at Compilation.applyPluginsAsyncSeries (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Tapable.js:206:13) at Compilation.seal (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:579:8) at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compiler.js:493:16 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Tapable.js:289:11 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:481:11 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:452:13 at processTicksAndRejections (internal/process/task_queues.js:79:11) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! client@1.0.0 build-dev: webpack --config webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the client@1.0.0 build-dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\NOTE\AppData\Roaming\npm-cache_logs\2020-09-17T18_02_39_300Z-debug.log

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client>

5 respostas

Olá Rubens, tudo bem?

no seu código, está configurado:

chunk.sortModules()

Remova o () do SortModules, ele não é uma função, e sim um atributo. Exemplo:

chunk.sortModules

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client>npm start

client@1.0.0 start C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client webpack-dev-server

Project is running at http://localhost:8080/ webpack output is served from /dist C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:189 _async2.default.forEach(chunk.mapModules(function (c) { ^

TypeError: chunk.mapModules is not a function at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:189:43 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:3110:16 at eachOfArrayLike (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:1069:9) at eachOf (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:1117:5) at Object.eachLimit (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:3172:5) at Compilation. (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:184:27) at Compilation.applyPluginsAsyncSeries (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Tapable.js:206:13) at Compilation.seal (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:579:8) at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compiler.js:493:16 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Tapable.js:289:11 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! client@1.0.0 start: webpack-dev-server npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the client@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\NOTE\AppData\Roaming\npm-cache_logs\2020-09-18T13_39_06_320Z-debug.log

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client>npm install css-loader@0.28.4 style-loader@0.18.2 --save-dev npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools. npm WARN extract-text-webpack-plugin@3.0.0 requires a peer of webpack@^3.1.0 but none is installed. You must install peer dependencies yourself. npm WARN client@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

  • style-loader@0.18.2
  • css-loader@0.28.4 updated 2 packages and audited 751 packages in 33.712s

24 packages are looking for funding run npm fund for details

found 6 vulnerabilities (2 low, 3 moderate, 1 high) run npm audit fix to fix them, or npm audit for details

Alguém pode me ajudar?

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client>npm run build-dev

client@1.0.0 build-dev C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client webpack --config webpack.config.js

C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:188 chunk.sortModules(c); ^

ReferenceError: c is not defined at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:188:31 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:3110:16 at eachOfArrayLike (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:1069:9) at eachOf (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:1117:5) at Object.eachLimit (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\async\dist\async.js:3172:5) at Compilation. (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\extract-text-webpack-plugin\dist\index.js:184:27) at Compilation.applyPluginsAsyncSeries (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Tapable.js:206:13) at Compilation.seal (C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:579:8) at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compiler.js:493:16 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\tapable\lib\Tapable.js:289:11 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:481:11 at C:\Users\NOTE\Downloads\01-projeto-webpack\projeto-webpack\client\node_modules\webpack\lib\Compilation.js:452:13 at processTicksAndRejections (internal/process/task_queues.js:79:11) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! client@1.0.0 build-dev: webpack --config webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the client@1.0.0 build-dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\NOTE\AppData\Roaming\npm-cache_logs\2020-09-21T12_25_14_194Z-debug.log

solução!

Boa noite, Rubens. Eu tive o mesmo problema e resolvi desinstalando e reinstalando os módulos de acordo com as versões utilizadas nas aulas.

Pra facilitar, vou colocar os comando que rodei.


npm uninstall webpack
npm install webpack@3.1.0 --save-dev

npm uninstall webpack-dev-server
npm install webpack-dev-server@2.5.1 --save-dev

npm uninstall webpack-cli

npm uninstall css-loader
npm install css-loader@0.28.2 --save-dev

Esses foram os comandos que funcionaram aqui, mas no seu caso pode ser diferente. Então sugiro que de uma olhada no seu package.json e confira se as versões são as mesmas das utilizadas no curso.

Espero ter ajudado, bons estudos!