angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng serve --aot fail after file change

Open WandererInVoids opened this issue 8 years ago • 67 comments

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Angular CLI: 6.1.2 Node: 10.0.0 OS: win32 x64 Angular: 6.1.2 ... animations, cli, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, platform-server, router ... service-worker

Package Version

@angular-devkit/architect 0.7.2 @angular-devkit/build-angular 0.7.2 @angular-devkit/build-optimizer 0.7.2 @angular-devkit/build-webpack 0.7.2 @angular-devkit/core 0.7.2 @angular-devkit/schematics 0.7.2 @angular/cdk 6.4.3 @angular/material 6.4.3 @ngtools/webpack 6.1.2 @schematics/angular 0.7.2 @schematics/update 0.7.2 rxjs 6.2.2 typescript 2.9.2 webpack 4.9.2 -->

Repro steps

  1. run ng serve with aot flag
  2. change something in watch filles
  3. see error in module find(file that change)

The log given by the failure

Module not found: Error: Can't resolve '@angular/material/button.ngfactory' in 'D:\Flare\flare.ui2\src\homeapp\app\components\reports\profitAndLoss'
ERROR in ./src/homeapp/app/components/reports/profitAndLoss/profit.and.loss.ngfactory.js
Module not found: Error: Can't resolve '@angular/material/checkbox.ngfactory' in 'D:\Flare\flare.ui2\src\homeapp\app\components\reports\profitAndLoss'
ERROR in ./src/homeapp/app/components/reports/profitAndLoss/profit.and.loss.ngfactory.js
Module not found: Error: Can't resolve '@angular/material/form-field.ngfactory' in '.\src\homeapp\app\components\reports\profitAndLoss'
ERROR in ./src/homeapp/app/components/reports/profitAndLoss/profit.and.loss.ngfactory.js
Module not found: Error: Can't resolve '@angular/material/menu.ngfactory' in '.\src\homeapp\app\components\reports\profitAndLoss'

Date: 2018-08-09T17:57:03.581Z - Hash: 12b8572033feade48d1a - Time: 34472ms
4 unchanged chunks
chunk {main} main.js (main) 16.2 MB [initial] [rendered]

i 「wdm」: Failed to compile.

Desired functionality

work as before update

Mention any other details that might be useful

I didn't know where to write, in @angular/compile or here but error showed in cli, so... This breaking from this fix https://github.com/angular/angular/pull/25335. Reverting @angular/compiler to 6.1.1 workaround for this. I tested without fix, it work as before.

WandererInVoids avatar Aug 09 '18 18:08 WandererInVoids

@andrewantar try removing optimization flags in angular.json

gatsbyz avatar Mar 19 '19 15:03 gatsbyz

@gatsbyz Set them to false and also tried removing the params, and still same error..

andrewantar avatar Mar 19 '19 17:03 andrewantar

@andrewantar And you've tried removing this from your tsconfig.json -> "rootDir": "./src"

gatsbyz avatar Mar 19 '19 18:03 gatsbyz

If your tsconfig.json has this path. remove and try it. It worked for me.

"paths": { "@angular/*": ["../node_modules/@angular/*"] },

snatuva avatar Apr 19 '19 17:04 snatuva

If your tsconfig.json has this path. remove and try it. It worked for me.

"paths": { "@angular/*": ["../node_modules/@angular/*"] },

It works like black magic mate!!!!!!!

alvaroarandaj avatar Jun 17 '19 15:06 alvaroarandaj

I am still getting error in Angular 7.2.15 while building using --aot flag. Normal build is working fine. The error message looks like:

ERROR in src\app\Test.component.html(6,8): : Property 'sort' does not exist on type 'TestComponent'.

src\app\Test.component.html(3,74): : Property 'allowUnsort' does not exist on type 'TestComponent'.

It is not recognizing any of the kendo grid properties. My kendo grid html looks like this:

<kendo-grid #grid [kendoGridBinding]="gridData | async" [pageSize]="10" [pageable]="true" [filterable]="true"
  [groupable]="true" [resizable]="true" [reorderable]="true" [filterable]="true" [columnMenu]="true"
  [rowClass]="rowCallback" (dataStateChange)="onDataStateChange($event)" [sortable]="{
    allowUnsort: allowUnsort,
    mode: multiple ? 'multiple' : 'single'
    }" [sort]="sort" (sortChange)="sortChange($event)">

bishwa-poudel avatar Jul 27 '19 09:07 bishwa-poudel

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.