Skip to content

Build --watch failing on rebuild #8332

Closed

Description

@barnatoth

Bug Report or Feature Request (mark with an x)

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

Versions.

Angular CLI: 1.5.0
Node: 8.1.0
OS: darwin x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 2.0.0-beta.12
@angular/cli: 1.5.0
@angular/flex-layout: 2.0.0-beta.10
@angular/material: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.6.1
webpack: 3.8.1

Repro steps.

  1. Run in terminal: ./node_modules/.bin/ng build --aot --env=dev --watch
  2. -> The build is successful
  3. Add a new line to any source file
  4. The build will throw an error:
ERROR in Error: Debug Failure. False expression: Host should not return a redirect source file from `getSourceFile`
    at tryReuseStructureFromOldProgram (/node_modules/typescript/lib/typescript.js:72100:26)
    at Object.createProgram (/node_modules/typescript/lib/typescript.js:71808:34)
    at AngularCompilerProgram._createProgramWithBasicStubs (/node_modules/@angular/compiler-cli/src/transformers/program.js:431:29)
    at /node_modules/@angular/compiler-cli/src/transformers/program.js:144:28
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)

The log given by the failure.

ERROR in Error: Debug Failure. False expression: Host should not return a redirect source file from `getSourceFile`
    at tryReuseStructureFromOldProgram (/node_modules/typescript/lib/typescript.js:72100:26)
    at Object.createProgram (/node_modules/typescript/lib/typescript.js:71808:34)
    at AngularCompilerProgram._createProgramWithBasicStubs (/node_modules/@angular/compiler-cli/src/transformers/program.js:431:29)
    at /node_modules/@angular/compiler-cli/src/transformers/program.js:144:28
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)

Desired functionality.

Adding a new line shouldn't break the build

Activity

  1. thaoula commented on Nov 8, 2017

    @thaoula

    Hi Guys,

    I also get this issue on change of source code like fixing an import reference.

    I am using ng serve --aot

    Regards,
    Tarek

  2. Hacklone commented on Nov 8, 2017

    @Hacklone

    I reverted my typescript version to “<2.5.0” and it’s working fine.

  3. Brocco commented on Nov 10, 2017

    @Brocco
    Contributor

    The current version of typescript supported is 2.4.2, please use that version for now. Support for later versions of TypeScript are being looked into.

  4. subatomicglue commented on Nov 13, 2017

    @subatomicglue

    When using typescript 2.4.2 with ng build -prod, I get this error.
    (Which the fix here says to upgrade typescript to 2.6.1.)

    ERROR in ./node_modules/rxjs/_esm5/observable/BoundNodeCallbackObservable.js
    Module build failed: TypeError: Cannot read property 'type' of undefined at Object.getEffectiveTypeAnnotationNode (node_modules/typescript/lib/typescript.js:9341:17).
    

    When using typescript 2.6.1 with ng serve --aot, I get the above error when incrementally saving a .html or .ts file
    (Which the fix above says to downgrade to typescript 2.4.2...)

    ERROR in Error: Debug Failure. False expression: Host should not return a redirect source file from `getSourceFile`
        at tryReuseStructureFromOldProgram (.../node_modules/typescript/lib/typescript.js:72100:26)
        at Object.createProgram (.../node_modules/typescript/lib/typescript.js:71808:34)
        at AngularCompilerProgram._updateProgramWithTypeCheckStubs (.../node_modules/@angular/compiler-cli/src/transformers/program.js:461:30)
        at .../node_modules/@angular/compiler-cli/src/transformers/program.js:149:23
        at process._tickCallback (internal/process/next_tick.js:103:7)
    

    So I am in a catch 22, where I need typescript 2.4.2 for ng serve --aot and typescript 2.6.1 for ng build --prod.

  5. kevinbuhmann commented on Dec 19, 2017

    @kevinbuhmann
    Contributor

    See also #8434. Typescript@next (currently 2.7.0-dev.20171216) is needed to fix other issues as well.

  6. DcsMarcRemolt commented on Feb 26, 2018

    @DcsMarcRemolt

    The same error still shows up for current angular 5.2.x and @ngtools/webpack 1.10.1 if I use a TS version != 2.4.2. As Angular 5.2 officially supports TS 2.6 this is now a real bug, please reopen.

  7. kspearrin commented on Apr 7, 2018

    @kspearrin

    Same problem here using Typescript 2.6.2, webpack 3.10, Angular 5.2.x with ngtools/webpack 1.10.2 (compiler-cli 5.2).

  8. denishvachhani commented on May 22, 2018

    @denishvachhani

    Same problem here using Typescript 2.7.2, webpack 3.11.0, Angular 5.2.9

    ERROR in Error: Debug Failure. False expression: Host should not return a redirect source file from getSourceFileat tryReuseStructureFromOldProgram (/node_modules/typescript/lib/typescript.js:74285:26) at Object.createProgram (/node_modules/typescript/lib/typescript.js:73988:34) at AngularCompilerProgram._updateProgramWithTypeCheckStubs (/node_modules/@angular/compiler-cli/src/transformers/program.js:460:30) at /node_modules/@angular/compiler-cli/src/transformers/program.js:148:23 at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)

  9. klemenoslaj commented on Jun 19, 2018

    @klemenoslaj

    @Brocco I understand the issue was closed initially due to TypeScript version mismatch, but it seems like the issue can still be reproduced with 6.0.8, easily. Should this issue be reopened?

    Angular CLI: 6.0.8
    Node: 8.11.2
    OS: darwin x64
    Angular: 6.0.5
    ... animations, common, compiler, compiler-cli, core, forms
    ... http, language-service, platform-browser
    ... platform-browser-dynamic, router, upgrade
    
    Package                           Version
    -----------------------------------------------------------
    @angular-devkit/architect         0.6.8
    @angular-devkit/build-angular     0.6.8
    @angular-devkit/build-optimizer   0.6.8
    @angular-devkit/core              0.6.8
    @angular-devkit/schematics        0.6.8
    @angular/cli                      6.0.8
    @ngtools/webpack                  6.0.8
    @schematics/angular               0.6.8
    @schematics/update                0.6.8
    rxjs                              6.2.1
    typescript                        2.7.2
    webpack                           4.8.3
    
  10. coryrylan commented on Jun 21, 2018

    @coryrylan
    Contributor

    I just ran into this as well on 6.1.0-rc.0

    Angular CLI: 6.1.0-rc.0
    Node: 8.9.1
    OS: win32 x64
    Angular: 6.0.6
    ... animations, common, compiler, compiler-cli, core, forms
    ... http, language-service, platform-browser
    ... platform-browser-dynamic, platform-server, router
    
    Package                           Version
    -----------------------------------------------------------
    @angular-devkit/architect         0.7.0-rc.0
    @angular-devkit/build-angular     0.7.0-rc.0
    @angular-devkit/build-optimizer   0.7.0-rc.0
    @angular-devkit/core              0.7.0-rc.0
    @angular-devkit/schematics        0.7.0-rc.0
    @angular/cli                      6.1.0-rc.0
    @schematics/angular               0.7.0-rc.0
    @schematics/update                0.7.0-rc.0
    rxjs                              6.2.0
    typescript                        2.7.2
    webpack                           4.8.1
    
  11. Dunos commented on Jul 16, 2018

    @Dunos

    Can confirm this is still a thing with Angular 6.0.9 and CLI 6.0.8, issue should be reopen

  12. glebmachine commented on Aug 5, 2018

    @glebmachine

    I've got same error on production build

  13. lorado commented on Sep 7, 2018

    @lorado

    When I run project with JIT compilation - cli can build, and the rebuild on changes. When I compile with AOT - first build succeed, but on change cli can't rebuild, and displays

    ERROR in Debug Failure. False expression: Host should not return a redirect source file from `getSourceFile`
    ℹ 「wdm」: Failed to compile.
    
    Angular CLI: 6.2.1
    Node: 10.1.0
    OS: darwin x64
    Angular: 6.1.7
    ... animations, common, compiler, compiler-cli, core, forms
    ... http, language-service, platform-browser
    ... platform-browser-dynamic, router
    
    Package                           Version
    -----------------------------------------------------------
    @angular-devkit/architect         0.7.5
    @angular-devkit/build-angular     0.7.5
    @angular-devkit/build-optimizer   0.7.5
    @angular-devkit/build-webpack     0.7.5
    @angular-devkit/core              0.7.5
    @angular-devkit/schematics        0.8.1
    @angular/cli                      6.2.1
    @ngtools/webpack                  6.1.5
    @schematics/angular               0.8.1
    @schematics/update                0.8.1
    rxjs                              6.3.2
    typescript                        2.9.2
    webpack                           4.9.2
    
  14. DcsMarcRemolt commented on Sep 7, 2018

    @DcsMarcRemolt

    Guys, this ticket is closed and dead. The current ticket tracking the problem is angular/angular#22524

  15. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    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.

  16. locked and limited conversation to collaborators on Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions