Skip to content

AOT build fails #7113

Closed
Closed

Description

@adwd

Bug Report or Feature Request (mark with an x)

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

Versions.

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.2.3
node: 6.11.1
os: darwin 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.2.3
@angular/compiler-cli: 4.3.1
@angular/language-service: 4.3.1

Repro steps.

$ ng new hello
$ cd hello
$ ng build --prod

The log given by the failure.

$ ng build --prod
Hash: edf6fb3ccb1b82fa940c
Time: 10775ms
chunk    {0} polyfills.71b130084c52939ca448.bundle.js (polyfills) 177 kB {4} [initial] [rendered]
chunk    {1} main.e81f19d3f6b27a436c79.bundle.js (main) 1.09 kB {3} [initial] [rendered]
chunk    {2} styles.d41d8cd98f00b204e980.bundle.css (styles) 69 bytes {4} [initial] [rendered]
chunk    {3} vendor.f7457d5ac1e9743fd76f.bundle.js (vendor) 849 kB [initial] [rendered]
chunk    {4} inline.18e445e37a0efd4dcfa2.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 'hello/src'
 @ ./src/main.ts 3:0-74
 @ multi ./src/main.ts

Desired functionality.

aot build runs

Mention any other details that might be useful.

Maybe, enhanced-resolve 3.4.0 is cause.
webpack/enhanced-resolve#98

ng build --prod runs successfully after npm i enhanced-resolve@3.3.0 .

Activity

  1. mchmielarski commented on Jul 24, 2017

    @mchmielarski

    I noticed same problem and after npm i enhanced-resolve@3.3.0 I can build with AOT

  2. MasDevProject commented on Jul 24, 2017

    @MasDevProject

    Same problem here

  3. serhiisol commented on Jul 24, 2017

    @serhiisol
    Contributor

    @mchmielarski That's a very nice guess 👍

  4. zucker-rdrg commented on Jul 24, 2017

    @zucker-rdrg

    Same here.
    workaround: npm install enhanced-resolve@3.3.0

  5. jahller commented on Jul 24, 2017

    @jahller

    thanks for the solution guys, this problem just cost us the whole morning.
    adding enhanced-resolve@3.3.0 solved it.

  6. ChrisCherryfarmer commented on Jul 24, 2017

    @ChrisCherryfarmer

    Thx, same here.
    enhanced-resolve@3.3.0 solved the issue.

  7. kondi0 commented on Jul 24, 2017

    @kondi0

    The same here!

    enhanced-resolve@3.3.0 solved it!

  8. hpyou commented on Jul 24, 2017

    @hpyou

    thanks god for this issue, i fixed this problem the whole day

  9. thegitty commented on Jul 24, 2017

    @thegitty

    Workaround with "enhanced-resolve@3.3.0" seems to work on Mac OS but not on Linux!? Can anyone confirm this behavior?

  10. sculeb commented on Jul 24, 2017

    @sculeb

    works on linux ubuntu 16.04 for me

  11. TautvydasDerzinskas commented on Jul 24, 2017

    @TautvydasDerzinskas

    Same issue.

  12. TautvydasDerzinskas commented on Jul 24, 2017

    @TautvydasDerzinskas

    Guys, you should really use fixed dependency versions for Angular-Cli. It's been a millionth time when everything breaks because in new versions of sub dependencies there is something unexpected...

  13. cankayacan commented on Jul 24, 2017

    @cankayacan

    The angular-cli version is already fixed for us which is 1.3.1 but still we have this error.

  14. bmcswee commented on Jul 24, 2017

    @bmcswee

    Same issue for me. Resolved with enhanced-resolve@3.3.0 on Ubuntu Server.

    RIP the first 2 hours of my morning.

  15. 175 remaining items

  16. bhushangahire commented on Nov 9, 2017

    @bhushangahire

    I am getting the same issue for Angular CLI 1.5.0 I also have Enhanced resolve 3.3.0

  17. eduibrahim commented on Nov 9, 2017

    @eduibrahim

    Me too. Still getting: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'

    Even after use Angular CLI 1.5.0 and Enhanced resolve 3.3.0

  18. stefdelec commented on Dec 4, 2017

    @stefdelec

    Same here. Any Update ?

  19. manpreetpc commented on Jan 1, 2018

    @manpreetpc

    enhanced-resolve@3.3.0 is not work for me
    package.json
    {
    "name": "LENDZ",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
    "@angular/common": "5.0.0",
    "@angular/compiler": "5.0.0",
    "@angular/compiler-cli": "5.0.0",
    "@angular/core": "5.0.0",
    "@angular/forms": "5.0.0",
    "@angular/http": "5.0.0",
    "@angular/platform-browser": "5.0.0",
    "@angular/platform-browser-dynamic": "5.0.0",
    "@ionic-native/camera": "^4.4.2",
    "@ionic-native/core": "4.3.2",
    "@ionic-native/diagnostic": "^4.5.2",
    "@ionic-native/facebook": "^4.4.2",
    "@ionic-native/file": "^4.4.2",
    "@ionic-native/file-path": "^4.4.2",
    "@ionic-native/geolocation": "^4.4.2",
    "@ionic-native/google-maps": "^4.4.2",
    "@ionic-native/http": "^4.4.2",
    "@ionic-native/native-storage": "^4.4.2",
    "@ionic-native/network": "^4.5.2",
    "@ionic-native/onesignal": "^4.5.2",
    "@ionic-native/push": "^4.4.2",
    "@ionic-native/splash-screen": "4.3.2",
    "@ionic-native/status-bar": "4.3.2",
    "@ionic-native/stripe": "^4.5.2",
    "@ionic-native/transfer": "^3.14.0",
    "@ionic/storage": "^2.1.3",
    "angular2-moment": "^1.7.0",
    "cordova-android": "6.3.0",
    "cordova-browser": "~5.0.1",
    "cordova-plugin-camera": "^3.0.0",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-file-transfer": "^1.7.0",
    "cordova-plugin-filepath": "^1.1.0",
    "cordova-plugin-geolocation": "^3.0.0",
    "cordova-plugin-googlemaps": "^2.1.1",
    "cordova-plugin-inappbrowser": "~1.7.2",
    "cordova-plugin-ionic-webview": "^1.1.11",
    "cordova-plugin-nativestorage": "^2.2.2",
    "cordova-plugin-network-information": "^1.3.4",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-stripe": "^1.5.3",
    "cordova-plugin-whitelist": "^1.3.1",
    "cordova-sqlite-storage": "^2.1.2",
    "cordova.plugins.diagnostic": "^3.7.2",
    "enhanced-resolve": "^3.4.1",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-rating": "^1.2.2",
    "ionicons": "3.0.0",
    "onesignal-cordova-plugin": "^2.2.4",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
    },
    "devDependencies": {
    "@ionic/app-scripts": "^3.1.7",
    "typescript": "2.4.2"
    },
    "description": "An Ionic project",
    "cordova": {
    "plugins": {
    "cordova-plugin-device": {},
    "cordova-plugin-ionic-webview": {},
    "cordova-plugin-splashscreen": {},
    "cordova-plugin-whitelist": {},
    "ionic-plugin-keyboard": {},
    "cordova-plugin-facebook4": {
    "APP_ID": "xxxxxxxxxxx",
    "APP_NAME": "LENDZ"
    },
    "cordova-plugin-nativestorage": {},
    "cordova-sqlite-storage": {},
    "cordova-plugin-camera": {},
    "cordova-plugin-file": {},
    "cordova-plugin-file-transfer": {},
    "cordova-plugin-filepath": {},
    "cordova-plugin-googlemaps": {
    "API_KEY_FOR_ANDROID": "xxxxxxxxxxxxxxxxxxxxxx",
    "API_KEY_FOR_IOS": "xxxxxxxxxxxxxxxxxxxx"
    },
    "cordova-plugin-geolocation": {},
    "onesignal-cordova-plugin": {},
    "cordova.plugins.diagnostic": {},
    "cordova-plugin-network-information": {},
    "cordova-plugin-inappbrowser": {},
    "cordova-plugin-stripe": {}
    },
    "platforms": [
    "browser",
    "android"
    ]
    }
    }
    Please help

  20. Sparker73 commented on Jan 19, 2018

    @Sparker73

    As @cbeaujoin well said. If you leave it like this you will build with AOT without troubles.

    dependencies
        @angular/*:"^4.3.6"
        "enhanced-resolve": "3.3.0"
    devDependencies
        "@angular/cli": "1.2.6"
        "typescript": "^2.3.4"
    

    I have to add that typescript had to be 2.3.4 for me, and the best of all, the build time was drastically reduced to around 6:35 when before it was taking about 29min to build. I will stay like this for a while.

  21. jkrajinovic commented on Mar 6, 2018

    @jkrajinovic

    enhanced-resolve@3.3.0 solved it!

  22. 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.

  23. locked and limited conversation to collaborators on Sep 8, 2019
  24. added a commit that references this issue on Jul 14, 2026
    333a708
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0Issue that causes an outage, breakage, or major function to be unusable, with no known workaroundsworkaround2: non-obvious

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions