AOT error this.host.isSourceFile is not a function
Please provide us with the following information:
OS?
Ubuntu 16.04 Linux Mint 18.1
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here: angular-cli: 1.0.0-beta.24 node: 7.2.1 os: linux x64 @angular/common: 2.4.0 @angular/compiler: 2.4.0 @angular/core: 2.4.0 @angular/forms: 2.4.0 @angular/http: 2.4.0 @angular/platform-browser: 2.4.0 @angular/platform-browser-dynamic: 2.4.0 @angular/router: 3.3.1 @angular/compiler-cli: 2.3.1
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
ng build -prod --aot
ng build --aot
The log given by the failure.
Normally this include a stack trace and some more information.
Time: 7649ms
chunk {0} main.117bc7f89a641eb460be.bundle.js, main.117bc7f89a641eb460be.bundle.map (main) 1.15 kB {2} [initial] [rendered]
chunk {1} styles.0d70df7dda13fb01d123.bundle.css, styles.0d70df7dda13fb01d123.bundle.map, styles.0d70df7dda13fb01d123.bundle.map (styles) 1.69 kB {3} [initial] [rendered]
chunk {2} vendor.078bc367dec701b1150c.bundle.js, vendor.078bc367dec701b1150c.bundle.map (vendor) 1.06 MB [initial] [rendered]
chunk {3} inline.4357686ae3fba1b6d5e7.bundle.js, inline.4357686ae3fba1b6d5e7.bundle.map (inline) 0 bytes [entry] [rendered]
ERROR in this.host.isSourceFile is not a function
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/alex/Dev/ng2/learn/playng/src'
@ ./src/main.ts 4:0-74
@ multi main
ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/home/alex/Dev/ng2/learn/playng/src/$$_gendir' in '/home/alex/Dev/ng2/learn/playng/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi main
Mention any other details that might be useful.
repo link: https://github.com/Codenator81/tour-of-heroes-angularfire2
live site: https://n2play-ee2bb.firebaseapp.com/
it worked without --aot parametr
Thanks! We'll be in touch soon.
Updated @angular/compiler-cli: 2.3.1 to 2.4.0 got errors
ERROR in Can't resolve all parameters for FirebaseSdkAuthBackend in /home/alex/Dev/ng2/learn/playng/node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts: ([object Object], ?).
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/alex/Dev/ng2/learn/playng/src'
@ ./src/main.ts 4:0-74
@ multi main
ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/home/alex/Dev/ng2/learn/playng/src/$$_gendir' in '/home/alex/Dev/ng2/learn/playng/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi main
without aot all good
The same error
The same error + ERROR in MainModule is not an NgModule
@kunl and @Kupstas try update compiler-cli to 2.4.0. As you see my error different after that. I think it is now more related to Firebase?
@Codenator81 I'm using only Clarity. Update has no effect for me
Same error here... without aot.
@antonybudianto mentioned in https://github.com/angular/angular-cli/issues/3761 that this is likely related to angularfire2.
For my case:
- Doing JIT build seems fine (either using ngtools/webpack with codegeneration disabled or using template+router loaders) and app running well
- Doing AOT build fails
- Successful after upgrade angularfire2 to beta.7-pre, look https://github.com/angular/angularfire2/issues/728
- but only the build succeed, the app is throwing error on runtime, looks like AOT did something to my constant exports that my config values are
undefinedwhen accessed by angularfire2
I was seeing something similar to your original error, and my versions were similar to yours (almost all the @angular packages at 2.4.1, but @angular/compiler-cli at 2.3.1. (My guess is that, when updating, I missed the compiler-cli reference in packages.json because it's in the devDependencies section.) I updated @angular/compiler-cli to 2.4.1, and the problem went away. FWIW...
I remove angularfire2 and moved to MongoDb then worked as needed, so this related to angularfire2
my repo https://github.com/Codenator81/tour-of-heroes-mongodb
Got the same error compiling aot, and im NOT using angularfire2 - not that i know of anyway.
Any pointers to fix this is highly appreciated.
@chriseenberg you should check the @angular/compiler version in your package.json file like dtgriscom mentioned. Fixed the issue for me (old project, compiler was still under dependencies)
My compiler is the same version as the rest of the angular modules. But thanks your time :) This error has reappeared after npm install.
Update: Freezing cli version to 1.0.0-rc.4 then deleting node_modules and fresh npm install fixed the issue for me.
Why issue is closed? Nothing works!
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
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.