Skip to content

ng build --build-optimizer --aot fails when upgrading to @angular-devkit/build-angular 0.6.8 #11192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexjlockwood opened this issue Jun 10, 2018 · 12 comments

Comments

@alexjlockwood
Copy link

Bug Report or Feature Request (mark with an x)

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

Area

- [x] devkit
- [ ] schematics

Versions

Running Mac OS X High Sierra 10.13.5.

$ node --version
v9.10.1

$ npm --version
6.1.0

$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.0.8
Node: 9.10.1
OS: darwin x64
Angular: 6.0.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

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/cdk                      6.2.1
@angular/cli                      6.0.8
@angular/flex-layout              6.0.0-beta.16
@angular/material                 6.2.1
@angular/pwa                      0.7.0-beta.1
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.0
typescript                        2.7.2
webpack                           4.8.3

Repro steps

First, clone the project and checkout the branch I've created for the purposes of this bug report:

git clone https://github.com/alexjlockwood/ShapeShifter
cd ShapeShifter
git checkout angular-cli-build-error

Then build the project using the following commands:

npm install
ng build --build-optimizer --aot

The log given by the failure

$ ng build --build-optimizer --aot
                                                                                          
Date: 2018-06-10T19:25:03.454Z
Hash: 353caaa8f1b364972ab1
Time: 64928ms
chunk {main} main.js, main.js.map (main) 1.8 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 305 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 163 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 8.16 MB [initial] [rendered]

ERROR in ./node_modules/svgo/plugins/_path.js
Module build failed: Error: Debug Failure. False expression.
    at getJSDocTags (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:13173:22)
    at getFirstJSDocTag (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:13181:24)
    at Object.getJSDocType (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:13149:19)
    at getContextualSignature (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:40930:32)
    at checkFunctionExpressionOrObjectLiteralMethod (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:44548:43)
    at checkExpressionWorker (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45605:28)
    at checkExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45533:42)
    at checkExpressionCached (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45384:38)
    at getWidenedTypeFromJSSpecialPropertyDeclarations (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:30686:46)
    at getTypeOfVariableOrParameterOrProperty (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:30961:28)
    at getTypeOfSymbol (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:31171:24)
    at checkPropertyAccessExpressionOrQualifiedName (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:42266:53)
    at checkPropertyAccessExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:42221:20)
    at checkExpressionWorker (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45587:28)
    at checkExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45533:42)
    at checkBinaryLikeExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45081:28)
ERROR in ./node_modules/svgo/lib/svgo/tools.js
Module build failed: Error: Debug Failure. False expression.
    at getJSDocTags (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:13173:22)
    at getFirstJSDocTag (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:13181:24)
    at Object.getJSDocType (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:13149:19)
    at getContextualSignature (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:40930:32)
    at checkFunctionExpressionOrObjectLiteralMethod (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:44548:43)
    at checkExpressionWorker (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45605:28)
    at checkExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45533:42)
    at checkExpressionCached (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45384:38)
    at getWidenedTypeFromJSSpecialPropertyDeclarations (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:30686:46)
    at getTypeOfVariableOrParameterOrProperty (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:30961:28)
    at getTypeOfSymbol (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:31171:24)
    at checkPropertyAccessExpressionOrQualifiedName (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:42266:53)
    at checkPropertyAccessExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:42221:20)
    at checkExpressionWorker (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45587:28)
    at checkExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45533:42)
    at checkBinaryLikeExpression (/Users/alockwood/ShapeShifter/node_modules/@angular-devkit/build-optimizer/node_modules/typescript/lib/typescript.js:45081:28)

Mention any other details that might be useful

This error does not show up when setting @angular-devkit/build-angular": "0.6.7" in my package.json (I only see the error when upgrading to 0.6.8).

@wvanderdeijl
Copy link

wvanderdeijl commented Jun 11, 2018

We seem to suffer from this same issue. The CI server fails on every build with this same stack trace, but local builds are fine. I can reproduce the following scenarion (multiple times):

  • delete note_modules and do a clean npm install
  • ng build --build-optimizer --aot fails with the above error (even when run multiple times)
  • ng build --build-optimizer --aot --prod succeeds without any error
  • any subsequent runs of ng build --build-optimizer --aot also complete without any error
  • as soon as node_modules is cleared and reinstalled the non-prod builds start failing again.

Perhaps this can help tracking down the issue

UPDATE: after some more investigation this seems related to node_modules/@angular-devkit/build-optimizer/src/.cache. If this cache is created with the --prod built any subsequent build will succeed (with or without --prod). But when you clear this build-optimizer cache any subsequent build without --prod will fail.

@B4nan
Copy link

B4nan commented Jun 17, 2018

Just arrived to the same error, confirming that with 0.6.7 it works. Also note that this error occurred after I implemented lazy modules into my app, so it will be probably connected.

@ramandeep-singh-1983
Copy link

i just noticed this after including yarn to mirror our npm packages offline and doing a prod build (ng build --prod) with version 0.6.8. Version 0.6.7 works fine.

@rhalff
Copy link

rhalff commented Jul 6, 2018

I can confirm reverting to 0.6.7 works, for me the error also occurs in a lazy loaded module.

@djanesch
Copy link

djanesch commented Jul 9, 2018

Also can confirm this issue here. With 0.6.8 the error occurs with 0.6.7 not.
I also read about threads where you should use a particular typescript version of 2.8.4. But this doesn't solve my problem.
Im sticking now with 2.7.2 of typscript and 0.6.7 with build-angular and the compiling process finishes as expected. huch

seokju-na added a commit to seokju-na/geeks-diary that referenced this issue Jul 20, 2018
An error occurs, if build angular production mode from version 0.6.8.
('remarkable' causes the error)

This commit fix the issue by downgrading angular cli version to 0.6.7.
See details via angular/angular-cli#11192
@ghaiat
Copy link

ghaiat commented Jul 26, 2018

Hello
version 0.7.0 has still the same issue. any updates on this ?

@alexjlockwood
Copy link
Author

0.7.1 still has the issue as well.

@alexjlockwood
Copy link
Author

0.7.5 has the same issue.

Any updates on this? I've been unable to update these dependencies for a few months now. Can anyone suggest a workaround?

@alvarocamillont
Copy link

I pinned the version "0.6.7" in my package.json

@alexjlockwood
Copy link
Author

Yeah, that's what I've been doing. Would really like to update soon though.

@filipesilva
Copy link
Contributor

filipesilva commented Oct 25, 2018

For context, I believe this is the same as reported in #11055 and #11918.

This happens because Build Optimizer functions slightly differently with and without sourcemaps. Without sourcemaps we take shortcuts that make it much faster.

As far as I can tell, when the shortcuts are not taken we run into a TypeScript 2.9 bug: microsoft/TypeScript#26253, microsoft/TypeScript#2506. microsoft/TypeScript#24963 (these are all the same AFAIK).

I think this bug is sorted in TS 3.x, and we updated out build optimizer dependencies accordingly. So if you update to @angular-devkit/[email protected] it should go away. This should work even on Angular 6 projects.

Let me know if you still see this, and if so, please give me a repro that I can look into.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants