Home > OS >  CRA error. Html Webpack Plugin: Error: Child compilation failed:
CRA error. Html Webpack Plugin: Error: Child compilation failed:

Time:02-13

I create a default react app with npx create-react-app app-name --template typescript but my app isn't working. Error:

Html Webpack Plugin:
  Error: Child compilation failed:
  Module build failed (from ../../../#Node/authorization/6. crypto-converter/node_modules/html-webpack-pl  ugin/lib/loader.js):
  Error: Cannot find module 'C:\#Node\authorization\6. crypto-converter\node_modules\html-webpack-plugin\  lib\loader.js'
  Require stack:
  - C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\loadLoader.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunner.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\NormalModule.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\webpack-manifest-plugin\dist\index.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\react-scripts\config\webpack.config.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\react-scripts\scripts\start.js
      at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
      at Function.Module._load (node:internal/modules/cjs/loader:778:27)
      at Module.require (node:internal/modules/cjs/loader:1005:19)
      at require (node:internal/modules/cjs/helpers:102:18)
      at loadLoader (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\loadLoader.  js:19:17)
      at iteratePitchingLoaders (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib  \LoaderRunner.js:182:2)
      at runLoaders (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunne  r.js:397:2)
      at NormalModule._doBuild (C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\Normal  Module.js:812:3)
      at NormalModule.build (C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\NormalMod  ule.js:956:15)
      at C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\Compilation.js:1367:12
  ModuleBuildError: Module build failed (from ../../../#Node/authorization/6. crypto-converter/node_modul  es/html-webpack-plugin/lib/loader.js):
  Error: Cannot find module 'C:\#Node\authorization\6. crypto-converter\node_modules\html-webpack-plugin\  lib\loader.js'
  Require stack:
  - C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\loadLoader.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunner.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\NormalModule.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\webpack-manifest-plugin\dist\index.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\react-scripts\config\webpack.config.js
  - C:\#Node\authorization\6. crypto-converter\node_modules\react-scripts\scripts\start.js
      at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
      at Function.Module._load (node:internal/modules/cjs/loader:778:27)
      at Module.require (node:internal/modules/cjs/loader:1005:19)
      at require (node:internal/modules/cjs/helpers:102:18)
      at loadLoader (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\loadLoader.  js:19:17)
      at iteratePitchingLoaders (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib  \LoaderRunner.js:182:2)
      at runLoaders (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunne  r.js:397:2)
      at NormalModule._doBuild (C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\Normal  Module.js:812:3)
      at NormalModule.build (C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\NormalMod  ule.js:956:15)
      at C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\Compilation.js:1367:12
      at processResult (C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\NormalModule.j  s:751:19)
      at C:\#Node\authorization\6. crypto-converter\node_modules\webpack\lib\NormalModule.js:853:5
      at C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunner.js:399:11
      at C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunner.js:185:11
      at loadLoader (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\loadLoader.  js:33:11)
      at iteratePitchingLoaders (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib  \LoaderRunner.js:182:2)
      at runLoaders (C:\#Node\authorization\6. crypto-converter\node_modules\loader-runner\lib\LoaderRunne  r.js:397:2)
...`

Before that I see warning:

(node:2720) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:2720) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.

I tried:

  • Create new app
  • Create app in other directories
  • Delete node.js
  • Install other versions of node.js (16.14.0, 17.4.0, 16.13.2 - active)

CodePudding user response:

Solution: install [email protected]. If you know how to fix problem with [email protected] write please.

  • Related