Skip to content
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

ng build aot just stops, with no error (silent fail) #8895

Closed
oguimbal opened this issue Dec 15, 2017 · 4 comments
Closed

ng build aot just stops, with no error (silent fail) #8895

oguimbal opened this issue Dec 15, 2017 · 4 comments

Comments

@oguimbal
Copy link

oguimbal commented Dec 15, 2017

Versions

Angular CLI: 1.6.1
Node: 8.9.1
OS: win32 x64
Angular: 5.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.1
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.1
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0

Repro steps

I cant reproduce it on another repository (and sharing mine is not an option).
I tried:

  • Deleting node_modules and reinstalling everything
  • Reproducing a similar configuration on another repository (AOT build works)
  • Various investigations (see below)

Observed behavior

AOT build just terminates after 5 seconds WITH NO ERROR (instead of 22secs required to build without AOT).
No error message, nothing generated in /dist, node process finishes with code 0.

... nb: ng build works perfectly without AOT.

image

Desired behavior

Well... I would expect it to build, or at least to yield some kind of error.

Mention any other details that might be useful (optional)

Further investigation yields (if it might be helpful):

  • It seems to be somehow related to SCSS, but the same SCSS was OK before my webpack+ng2 => cli+ng5 migration (see about my config below)
    [edit] It turns out that if I comment out all style imports (i.e. only those that are read during the compilation begining), it still fails without having read any .css or .scss file.
  • Last file read from disk seems to be a random file (but always the same on each identical run)
  • Last file read from disk changes if I change the order of my SCSS imports, and seems always to be a *.json
    [edit] Last read file can be .json, .html ... i dont see any pattern :(
  • process.on('exit') is called as if everything went fine
  • There is no exception thrown after this last file is read (not even a caught one, like the ones you get when you call existsSync on a non existing file with a 'catch all exceptions' debugger attached)
  • Build fails much sooner if I remove all scss imports in .angular-cli.json (after 2 modules built instead of 22) (??!)

... i'm a bit out of ideas, does anyone has any clue of what might happen ?

About my config

  • I recently migrated from Angular 2 to Angular 5, and from a custom Weback config (which was working using AOT builds) to angular/cli
  • It's a multi app repository (i.e. multiple apps listed in .angular-cli.json)
  • It use this small trick to avoid using ng eject to support pug/jade templates. But it is pretty simple, and works fine on other repos.

The only other fancy things with my config i can think of is that i'm using "paths" in my tsconfig.json to reference another module in my repo

    "paths": {
      "commons": ["path/to/common/module"]
    }
@oguimbal oguimbal changed the title ng build aot just stops, with no error ng build aot just stops, with no error (silent fail) Dec 15, 2017
@crutchcorn
Copy link

I just wrote up an issue with this. (or seemingly related to this) The following is my error information:

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Currently, when I try to use ng build --aot, I simply get the error:

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './app/app.module.ngfactory' in 'C:\Users\CorbinCrutchley\git\linkd-angular-5\src'
resolve './app/app.module.ngfactory' in 'C:\Users\CorbinCrutchley\git\linkd-angular-5\src'
  using description file: C:\Users\CorbinCrutchley\git\linkd-angular-5\package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: C:\Users\CorbinCrutchley\git\linkd-angular-5\package.json (relative path: ./src)
    using description file: C:\Users\CorbinCrutchley\git\linkd-angular-5\package.json (relative path: ./src/app/app.module.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory.js doesn't exist
      as directory
        C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory doesn't exist
[C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory]
[C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory.ts]
[C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory.js]
[C:\Users\CorbinCrutchley\git\linkd-angular-5\src\app\app.module.ngfactory]
 @ ./src/main.ts 4:0-66
 @ multi ./src/main.ts

However, when I run ngc -p src, I get the following errors:

Cannot determine the module for class VideoPlayerComponent in C:/Users/CorbinCrutchley/git/linkdtest/src/app/shared/components/video/player/video-player.component.ts! Add VideoPlayerComponent to the NgModule to fix it.
Cannot determine the module for class TutorialComponent in C:/Users/CorbinCrutchley/git/linkdtest/src/app/shared/components/tutorial/tutorial.component.ts! Add TutorialComponent to the NgModule to fix it.
Cannot determine the module for class ContactUsComponent in C:/Users/CorbinCrutchley/git/linkdtest/src/app/modules/toolbar/contact/contactus.component.ts! Add ContactUsComponent to the NgModule to fix it.
Cannot determine the module for class ConfirmComponent in C:/Users/CorbinCrutchley/git/linkdtest/src/app/shared/components/confirm/confirm.component.ts! Add ConfirmComponent to the NgModule to fix it.
Cannot determine the module for class ContactAddButtonComponent in C:/Users/CorbinCrutchley/git/linkdtest/src/app/shared/components/contacts/add-button/contacts.add-button.component.ts! Add ContactAddButtonComponent to the NgModule to fix it.

And more. It is clear to me that I am getting the proper errors from ngc, but the build is being silent on these errors when I use ng build --aot. This is not very helpful for tracking down errors

Expected behavior

Builds from ng build --aot should show ngc errors.

What is the motivation / use case for changing the behavior?

This would allow you to be able to solve issues with AOT in order to build properly

Environment

Angular CLI: 1.6.0
Node: 8.9.1
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.0.0
@angular/cli: 1.6.0
@angular/material: 5.0.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

@oguimbal
Copy link
Author

@crutchcorn Seems not to be the same issue: At least, you got an error, i dont :(

@oguimbal
Copy link
Author

Finally found it ! see #8904

@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants