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

Running ng build --aot does not show angular compiler errors

Open crutchcorn opened this issue 8 years ago • 4 comments

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

crutchcorn avatar Dec 16 '17 18:12 crutchcorn

@crutchcorn try updating to angular 5.1.1 and see if that resolves the issue

deebloo avatar Dec 16 '17 18:12 deebloo

It seems that Angular 5.1.1 resolves this issue for me

crutchcorn avatar Dec 18 '17 16:12 crutchcorn

My Angular version is 5.1.1 even though i'm getting this ERROR ERROR in ./src/app/app.module.ngfactory.js Module not found: Error: Can't resolve 'ngx-store/dist/src/service/local-storage.service' in 'C:\Users\a811891\taskmanagementv2ui\src\app' resolve 'ngx-store/dist/src/service/local-storage.service' in 'C:\Users\a811891\taskmanagementv2ui\src\app' Parsed request is a module using description file: C:\Users\a811891\taskmanagementv2ui\package.json (relative path: ./src/app) Field 'browser' doesn't contain a valid alias configuration after using description file: C:\Users\a811891\taskmanagementv2ui\package.json (relative path: ./src/app) resolve as module C:\Users\a811891\taskmanagementv2ui\src\app\node_modules doesn't exist or is not a directory C:\Users\a811891\taskmanagementv2ui\src\node_modules doesn't exist or is not a directory C:\Users\a811891\node_modules doesn't exist or is not a directory C:\Users\node_modules doesn't exist or is not a directory C:\node_modules doesn't exist or is not a directory looking for modules in C:\Users\a811891\taskmanagementv2ui\node_modules using description file: C:\Users\a811891\taskmanagementv2ui\package.json (relative path: ./node_modules) Field 'browser' doesn't contain a valid alias configuration after using description file: C:\Users\a811891\taskmanagementv2ui\package.json (relative path: ./node_modules) using description file: C:\Users\a811891\taskmanagementv2ui\node_modules\ngx-store\package.json (relative path: ./dist/src/service/local-storage.service) no extension Field 'browser' doesn't contain a valid alias configuration C:\Users\a811891\taskmanagementv2ui\node_modules\ngx-store\dist\src\service\local-storage.service doesn't exist .ts

Marudhuraj avatar Jul 26 '18 13:07 Marudhuraj

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.