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

AOT build fails #7113

Closed
adwd opened this issue Jul 24, 2017 · 173 comments
Closed

AOT build fails #7113

adwd opened this issue Jul 24, 2017 · 173 comments
Assignees
Labels
P0 Issue that causes an outage, breakage, or major function to be unusable, with no known workarounds workaround2: non-obvious

Comments

@adwd
Copy link

adwd commented Jul 24, 2017

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 .

@mchmielarski
Copy link

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

@MasDevProject
Copy link

Same problem here

@serhiisol
Copy link
Contributor

@mchmielarski That's a very nice guess 👍

@zucker-rdrg
Copy link

zucker-rdrg commented Jul 24, 2017

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

@jahller
Copy link

jahller commented Jul 24, 2017

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

@ChrisCherryfarmer
Copy link

ChrisCherryfarmer commented Jul 24, 2017

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

@kondi0
Copy link

kondi0 commented Jul 24, 2017

The same here!

enhanced-resolve@3.3.0 solved it!

@hpyou
Copy link

hpyou commented Jul 24, 2017

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

@thegitty
Copy link

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

@sculeb
Copy link

sculeb commented Jul 24, 2017

works on linux ubuntu 16.04 for me

@TautvydasDerzinskas
Copy link

Same issue.

@TautvydasDerzinskas
Copy link

TautvydasDerzinskas commented Jul 24, 2017

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

sguiheux added a commit to ovh/cds that referenced this issue Jul 24, 2017
@cankayacan
Copy link

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

@bmcswee
Copy link

bmcswee commented Jul 24, 2017

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

RIP the first 2 hours of my morning.

@erashu212
Copy link

erashu212 commented Jul 24, 2017

It worked for me too with 3.3.0.

@amiram
Copy link

amiram commented Jul 24, 2017

Still we have error in AOT even with 3.4.1. Also in development the environment.ts is not overwritten with the appropriate environment file

@webmutation
Copy link

This breaks all builds, amazing fun was had today! PLZ PLZ PLZ move to fixed dependency.

@tkoenig89
Copy link

tkoenig89 commented Jul 24, 2017

Issue still exists with enhanced-resolve@3.4.1 here. Same issue showing up.
Staying at 3.3.0 for now.

@Pittan
Copy link
Contributor

Pittan commented Jul 24, 2017

When creating new project with fresh installed angular/cli 1.2.0 fails, too :(
I used yarn for package management.

@pvanhemmen
Copy link

Same problem here. npm install enhanced-resolve@3.3.0 resolved the issue for me temporarily, but only when it's installed as an addition into an already up and running project. Deployment through a fresh install with npm install with this dependency set in package.json does not work.

This is a major bug, because it breaks a running deployment pipeline and with it the whole production setup.

@mscherer82
Copy link

I'm on windows and adding enhanced-resolve@3.3.0 doesn't work for me.

@angelnikolov
Copy link

@mscherer82 Did you run npm install? If you did, you can try deleting node_modules and re-running it. It worked for me.

@mscherer82
Copy link

@angelnikolov yes, I deleted node_modules and reinstalled all packages.

@angelnikolov
Copy link

Hm, can you try running npm ls and see if this is your enhanced-resolve version
+-- enhanced-resolve@3.3.0

@eelokets
Copy link

@pvanhemmen
You should install enhanced-resolve after npm install. As temporary resolve it's ok.
image

@pvanhemmen
Copy link

@vicetjs That's what I did and the only way it works for me, too. Thanx for your help!

@studds
Copy link

studds commented Aug 17, 2017

Am I correct in thinking that the npm i enhanced-resolve@3.3.0 is not a reliable fix? @angular/angular-cli@1.3.0 depends on webpack@3.4.1 which in turn depends on enhanced-resolve@3.4.1. npm seems fairly determined to make sure that webpack gets what it asks for.

I've tried installing enhanced-resolve@3.3.0 and it worked once, but then I ran npm install again and it stopped working. Am I missing something or is it rather difficult to get around this in a stable way?

danielwiehl added a commit to danielwiehl/edu-angular-change-detection that referenced this issue Aug 19, 2017
@filipesilva
Copy link
Contributor

@studds you shouldn't need to add enhanced-resolve manually with the newer versions.

@daniele-pecora
Copy link

Installing "enhanced-resolve": "^3.3.0" solved it for me

@joshikeerti
Copy link

joshikeerti commented Aug 24, 2017

I have enhanced resolve 3.3.0 and ngtools webpack 1.6.2,
Still seeing errors

Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/ui/package.json (relative path: ./src/app/Components/selector)

"@angular/animations": "^4.3.6",
"@angular/cdk": "2.0.0-beta.8",
"@angular/common": "^4.3.6",
"@angular/compiler": "^4.3.6",
"@angular/compiler-cli": "^4.3.6",
"@angular/core": "^4.3.6",
"@angular/forms": "^4.3.6",
"@angular/http": "^4.3.6",
"@angular/material": "^2.0.0-beta.8",
"@angular/platform-browser": "^4.3.6",
"@ngrx/core": "^1.0.2",
"@ngrx/effects": "^2.0.0",
"@ngrx/store": "^2.1.2",
"@ngtools/webpack": "^1.6.2",
"enhanced-resolve": "^3.3.0",

@cbeaujoin
Copy link

Finaly makes it work with devDependencies "@angular/cli": "1.2.6" and dependencies "enhanced-resolve": "3.3.0" and @angular/*:"^4.3.6"

@sukeshthakare
Copy link

I am getting this error while creating new angular project.

Installing packages for tooling via npm.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "--quiet" "install"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10

npm ERR! shasum check failed for C:\Users\Sukeshu\AppData\Local\Temp\npm-3120-1165392c\registry.npmjs.org\jasmine-spec-reporter-\jasmine-spec-reporter-4.1.1.tgz
npm ERR! Expected: 5a6d58ab5d61bea7309fbc279239511756b1b588
npm ERR! Actual: 1cca12519560608e42bb4efd78f30d818740a4f9
npm ERR! From: https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.1.1.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Sukeshu\Desktop\ng2\dapp\npm-debug.log

Package install failed, see above.
Package install failed, see above.

@dyngosz
Copy link

dyngosz commented Aug 28, 2017

"enhanced-resolve": "3.3.0" fixed the issue for me.

@xtianus79
Copy link

Just saying... if you are using prod build you should be using shrinkwrap... it's there for you guys to use. Also, yarn.

@xtianus79
Copy link

this issue creeped up for me using ngtools/webpack for my angular build... not using angular-cli and I specifically used ngtools/webpack 1.5.3 and the issue resolved itself... with using that other plugin....

So for people using ngtools/webpack simply use at this time version 1.5.3... adding the other package won't do anything no matter what version you use.

@yassinechabli
Copy link

upgrading angular/cli to 1.2.4 resolve the problem for me .

@adgang
Copy link

adgang commented Sep 22, 2017

Angular apps created with older cli still dont work. To get around it, i just copied a fresh package.json from a new app.
If you want to make existing angular app running, (some package among)the following packages(diff i got while getting my own app running) should be upgraded:

diff seodemo/package.json aotdemo/package.json
2c2
<   "name": "seodemo",
---
>   "name": "aotdemo",
15,23c15,23
<     "@angular/animations": "^4.0.0",
<     "@angular/common": "^4.0.0",
<     "@angular/compiler": "^4.0.0",
<     "@angular/core": "^4.0.0",
<     "@angular/forms": "^4.0.0",
<     "@angular/http": "^4.0.0",
<     "@angular/platform-browser": "^4.0.0",
<     "@angular/platform-browser-dynamic": "^4.0.0",
<     "@angular/router": "^4.4.3",
---
>     "@angular/animations": "^4.2.4",
>     "@angular/common": "^4.2.4",
>     "@angular/compiler": "^4.2.4",
>     "@angular/core": "^4.2.4",
>     "@angular/forms": "^4.2.4",
>     "@angular/http": "^4.2.4",
>     "@angular/platform-browser": "^4.2.4",
>     "@angular/platform-browser-dynamic": "^4.2.4",
>     "@angular/router": "^4.2.4",
25,26c25,26
<     "rxjs": "^5.1.0",
<     "zone.js": "^0.8.4"
---
>     "rxjs": "^5.4.2",
>     "zone.js": "^0.8.14"
29,31c29,31
<     "@angular/cli": "1.2.0",
<     "@angular/compiler-cli": "^4.0.0",
<     "@angular/language-service": "^4.0.0",
---
>     "@angular/cli": "1.4.3",
>     "@angular/compiler-cli": "^4.2.4",
>     "@angular/language-service": "^4.2.4",
35c35
<     "codelyzer": "~3.0.1",
---
>     "codelyzer": "~3.1.1",
45c45
<     "ts-node": "~3.0.4",
---
>     "ts-node": "~3.2.0",

@kernwig
Copy link

kernwig commented Oct 22, 2017

Should this help someone else:

After reading through this whole thing, I noticed the dependency: "@angular/cli": "1.1.x",

When I allowed that to upgrade, the problem went away.

harunurhan added a commit to harunurhan/ng2-multi-record-editor that referenced this issue Oct 25, 2017
* Refactors npm scripts.

* Changes build command to prods

* Fixes production build

* Upgrades angular-cli due to:
angular/angular-cli#7113

* Adds bugs and repo to package.json
@bhushangahire
Copy link

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

@eduibrahim
Copy link

eduibrahim commented Nov 9, 2017

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

@stefdelec
Copy link

Same here. Any Update ?

@manpreetpc
Copy link

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

@Sparker73
Copy link

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.

zuzust added a commit to adab1ts/veinapp that referenced this issue Feb 7, 2018
See angular/angular-cli#7113. Additionally, remove no longer needed fix to yarn issue (yarnpkg/yarni#3485).
zuzust added a commit to adab1ts/veinapp that referenced this issue Feb 7, 2018
See angular/angular-cli#7113. Additionally, remove no longer needed fix to yarn issue (yarnpkg/yarn#3485).
@jkrajinovic
Copy link

enhanced-resolve@3.3.0 solved it!

dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
See angular#7113 and webpack/enhanced-resolve#98 for context.

This should be unpinned when a real fix is found.
gzh added a commit to viinex/viinex-demo-ui that referenced this issue Mar 23, 2019
@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.
Labels
P0 Issue that causes an outage, breakage, or major function to be unusable, with no known workarounds workaround2: non-obvious
Projects
None yet
Development

No branches or pull requests