ng serve crashes after second code change

Viewed 417

The project is using Angular 12.1.2. ng version returns:

Angular CLI: 12.1.2
Node: 14.17.0
Package Manager: yarn 1.22.5
OS: win32 x64

Angular: 12.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, localize, material
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.2
@angular-devkit/build-angular   12.1.2
@angular-devkit/core            12.1.2
@angular-devkit/schematics      12.1.2
@angular/flex-layout            12.0.0-beta.34
@schematics/angular             12.1.2
rxjs                            6.6.7
typescript                      4.3.5

After making a second change to the source files, the ng serve crashes with the following error:

⠋ Generating browser application bundles...c:\EProsveta\viewer-new\node_modules\webpack\lib\json\JsonGenerator.js:119
                let data = module.buildInfo.jsonData;
                                            ^

TypeError: Cannot read property 'jsonData' of undefined
    at JsonGenerator.getSize (c:\EProsveta\viewer-new\node_modules\webpack\lib\json\JsonGenerator.js:119:31)
    at NormalModule.size (c:\EProsveta\viewer-new\node_modules\webpack\lib\NormalModule.js:1224:43)
    at NormalModule.cleanupForCache (c:\EProsveta\viewer-new\node_modules\webpack\lib\NormalModule.js:364:9)
    at NormalModuleFactory.cleanupForCache (c:\EProsveta\viewer-new\node_modules\webpack\lib\NormalModuleFactory.js:670:11)
    at Compiler._cleanupLastNormalModuleFactory (c:\EProsveta\viewer-new\node_modules\webpack\lib\Compiler.js:383:34)
    at Compiler.createNormalModuleFactory (c:\EProsveta\viewer-new\node_modules\webpack\lib\Compiler.js:1049:8)
    at Compiler.newCompilationParams (c:\EProsveta\viewer-new\node_modules\webpack\lib\Compiler.js:1071:30)
    at Compiler.compile (c:\EProsveta\viewer-new\node_modules\webpack\lib\Compiler.js:1082:23)
    at c:\EProsveta\viewer-new\node_modules\webpack\lib\Watching.js:188:19
    at Hook.eval [as callAsync] (eval at create (c:\EProsveta\viewer-new\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:22:1)

This is extremely annoying and time consuming. Anyone knows how to fix it? Thanks.

2 Answers

Changing to Angular 12.1.3 fixed it.

It seems like a problem by angular... Try uninstalling angular globally and then install it again

npm install -g @angular/cli@12.1.12
Related