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

Build error with Prod and AOT

Open ashfaqch opened this issue 9 years ago • 7 comments

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.1.0 node: 6.10.3 os: win32 x64 @angular/animations: 4.3.1 @angular/common: 4.3.1 @angular/compiler: 4.3.1 @angular/core: 4.3.1 @angular/forms: 4.3.1 @angular/http: 4.3.1 @angular/platform-browser: 4.3.1 @angular/platform-browser-dynamic: 4.3.1 @angular/router: 4.3.1 @angular/cli: 1.1.0 @angular/compiler-cli: 4.3.1 @angular/language-service: 4.3.1

Repro steps.

ng new app1 cd app1 ng build --prod --aot

The log given by the failure.

PS C:\Development\app1> ng build --prod --aot Hash: 0e1b8623fcaacef6ccdc Time: 7548ms chunk {0} polyfills.9ade66817b93b06337d0.bundle.js (polyfills) 177 kB {4} [initial] [rendered] chunk {1} main.40656b4d180dfa8e30fa.bundle.js (main) 679 bytes {3} [initial] [rendered] chunk {2} styles.d41d8cd98f00b204e980.bundle.css (styles) 69 bytes {4} [initial] [rendered] chunk {3} vendor.b0becb145c965d8dc808.bundle.js (vendor) 849 kB [initial] [rendered] chunk {4} inline.2f6680c481526349cbc6.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\Development\app1\src' @ ./src/main.ts 4:0-74 @ multi ./src/main.ts

Desired functionality.

aot should built without any errors

Mention any other details that might be useful.

ng build Run successfully ng build --prod Got same above error

ashfaqch avatar Jul 27 '17 22:07 ashfaqch

same issue @angular/cli 1.2.4

harryhahn avatar Jul 28 '17 07:07 harryhahn

Check solutions from here #7113

djhojd avatar Jul 28 '17 07:07 djhojd

Workaround npm install [email protected] --save-dev has solved my issue.

Is this right thing to do?

ashfaqch avatar Jul 28 '17 13:07 ashfaqch

@ashfaqch - you have 2 choices for a fix:

  1. Do what you show - pinning enhanced-resolve to version 3.3.0
  2. Upgrade to @angular/cli version 1.2.6 which fixes the issue with the newer enhanced-resolve.

daddyman avatar Jul 28 '17 14:07 daddyman

@ashfaqch as @daddyman daddyman just said, I upgraded the @angular/cli version to latest, in Updating Angular CLI and reproduced the steps and work perfectly. Probably, this issue should be changed to closed

donoso-eth avatar Jul 28 '17 14:07 donoso-eth

@daddyman @ampgular Thank you for your respond! I think i am going to upgrade angular/cli to 1.2.6 which seems to be right things to do.

ashfaqch avatar Jul 28 '17 14:07 ashfaqch

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.