Angular-cli: Uncaught Error: Can't resolve all parameters for...

Created on 25 Feb 2017  Â·  27Comments  Â·  Source: angular/angular-cli

Updated the angular cli to the latest and now my scripts bundle isnt generating... Getting these errors, any ideas ?

Uncaught Error: Can't resolve all parameters for HomepageComponent: (?, ?, ?).
    at CompileMetadataResolver.getDependenciesMetadata (http://localhost:4200/vendor.bundle.js:27650:19)
    at CompileMetadataResolver.getTypeMetadata (http://localhost:4200/vendor.bundle.js:27547:26)
    at CompileMetadataResolver.getDirectiveMetadata (http://localhost:4200/vendor.bundle.js:27320:28)
    at http://localhost:4200/vendor.bundle.js:27730:33
    at Array.forEach (native)
    at CompileMetadataResolver._getEntryComponentsFromProvider (http://localhost:4200/vendor.bundle.js:27729:30)
    at http://localhost:4200/vendor.bundle.js:27687:83
    at Array.forEach (native)
    at CompileMetadataResolver.getProvidersMetadata (http://localhost:4200/vendor.bundle.js:27674:19)
    at http://localhost:4200/vendor.bundle.js:27681:41

my angular-cli.json is

        {
            "project": {
                "version": "1.0.0-beta.16",
                "name": "angular2"
            },
            "apps": [{
                "root": "src",
                "outDir": "dist",
                "assets": "assets",
                "index": "index.html",
                "main": "main.ts",
                "test": "test.ts",
                "tsconfig": "tsconfig.json",
                "prefix": "app",
                "mobile": false,
                "styles": [],
                "scripts": [
                    "../node_modules/jquery/dist/jquery.min.js",
                    "./assets/js/seriously.js",
                    "./assets/js/remodal.js",
                    "./assets/js/wow.min.js",
                    "./assets/js/classie.js",
                    "./assets/js/masonry.js",
                    "./assets/js/owl.carousel.min.js",
                    "./assets/js/particles.min.js",
                    "./assets/js/selectFx.js",
                    "./assets/js/sintaxify.js"
                ],
                "environmentSource": "environments/environment.ts",
                "environments": {
                "source": "environments/environment.ts",
                "dev": "environments/environment.ts",
                "prod": "environments/environment.prod.ts"
                }
            }],
            "addons": [],
            "packages": [],
            "e2e": {
                "protractor": {
                    "config": "./protractor.conf.js"
                }
            },
            "test": {
                "karma": {
                    "config": "./karma.conf.js"
                }
            },
            "defaults": {
                "styleExt": "css",
                "prefixInterfaces": false
            }
        }

Most helpful comment

I had the exact same thing. I solved it by removing the Augury plugin.

All 27 comments

What are the 3 deps of HomepageComponent?

Im not even sure what I should be looking for, by dependencies do they mean imported libs ? as in angular, http etc etc... because they are all downloaded via npm anyway. Judging by the warnings its related to my 3rd party plugins which I have declared in the angular-cli.json

What is the vendor bundle, it used to be just scripts.bundle.js didnt it ?

So from the error message it looks like your HomepageComponent has 3 injected dependencies. You should see these as parameters on the constructor for HomepageComponent.

Yeah the constructor is like this:

constructor( private http: Http, private router: Router, private _API: Service ) {

just noticed that beforehand my app had only 3 scripts
inline.js
scripts.bundle.js
main.bundle.js

but now it has an additional one (vendor.bundle.js), as well as the other 3, and its the one that those errors seem to be pointing to.

Ok so Ive used --no-vendor-chunk and that removed those warnings from that file. Is it now necessary to inject into components ? for instance I had to change all my constructors to this kind of layout with the inject decorator and it got rid of the dependency warning

constructor( @Inject(Http) private http: Http, @Inject(Router) private router: Router, @Inject(Service) private _API: Service ) {

but now Im getting this which is really weird, why are the 404s looking for a url that ends in .html ??

GET http://localhost:4200/app.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:388Unhandled Promise rejection: Failed to load app.component.html ; Zone: ; Task: Promise.then ; Value: Failed to load app.component.html undefined
consoleError @ zone.js:388
_loop_1 @ zone.js:417
drainMicroTaskQueue @ zone.js:421
ZoneTask.invoke @ zone.js:339
zone.js:390Error: Uncaught (in promise): Failed to load app.component.html
at resolvePromise (zone.js:468)
at resolvePromise (zone.js:453)
at zone.js:502
at ZoneDelegate.invokeTask (zone.js:265)
at Zone.runTask (zone.js:154)
at drainMicroTaskQueue (zone.js:401)
at XMLHttpRequest.ZoneTask.invoke (zone.js:339)
consoleError @ zone.js:390
_loop_1 @ zone.js:417
drainMicroTaskQueue @ zone.js:421
ZoneTask.invoke @ zone.js:339
zone.js:1382GET http://localhost:4200/contact.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/contact-form.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/blog-main.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/blog-single.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/footer.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/home.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/menu.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/projects-main.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/social-wall.component.html 404 (Not Found)
scheduleTask @ zone.js:1382
ZoneDelegate.scheduleTask @ zone.js:245
Zone.scheduleMacroTask @ zone.js:171
(anonymous) @ zone.js:1405
send @ VM2108:3
ResourceLoaderImpl.get @ resource_loader_impl.js:45
DirectiveNormalizer._fetch @ directive_normalizer.js:41
DirectiveNormalizer.normalizeTemplateAsync @ directive_normalizer.js:84
DirectiveNormalizer.normalizeDirective @ directive_normalizer.js:59
RuntimeCompiler._createCompiledTemplate @ runtime_compiler.js:192
(anonymous) @ runtime_compiler.js:130
(anonymous) @ runtime_compiler.js:128
RuntimeCompiler._compileComponents @ runtime_compiler.js:127
RuntimeCompiler._compileModuleAndComponents @ runtime_compiler.js:64
RuntimeCompiler.compileModuleAsync @ runtime_compiler.js:55
PlatformRef_._bootstrapModuleWithZone @ application_ref.js:390
PlatformRef_.bootstrapModule @ application_ref.js:365
(anonymous) @ main.ts:9
__webpack_require__ @ bootstrap bae3eb2…:52
(anonymous) @ amd-options.js:2
__webpack_require__ @ bootstrap bae3eb2…:52
webpackJsonpCallback @ bootstrap bae3eb2…:23
(anonymous) @ main.bundle.js:1
zone.js:1382GET http://localhost:4200/homepage.component.html 404 (Not Found)

@REPTILEHAUS : how you resolved this..??
I am facing the same problem

You need to upgrade your dev environment (latest node, angular-cli, angular)

@REPTILEHAUS can you please share what exactly needs to be updated I have below setup:

Angular CLI: 1.5.4
Node: 8.9.1
OS: win32 x64
Angular: 5.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cdk: 5.0.0-rc.2
@angular/cli: 1.5.4
@angular/flex-layout: 2.0.0-beta.11-b01c2d7
@angular/material: 5.0.0-rc.2
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.4
@schematics/angular: 0.1.7
typescript: 2.4.2
webpack: 3.8.1

I had the same error message and it was because of circular dependency injection. :-/
Class1 {
constructor (private class2: Class2) { }
}
Class2 {
constructor (private class1: Class1) { }
}

hi, i have same issue but only on firefox, on chrome doesnt

Error: Uncaught (in promise): Error: Can't resolve all parameters for PopoverOptionsGrid: (?).

i have same issue

Currently facing the same issue. https://github.com/angular/angular/issues/16837 may be the same issue

It's wired, I met the same issue. I added @inject(Service) to all parameters in constructor, then the problem solved.

I'm having this issue, but only in normal Chrome. If I try in and incognito window, I do not get the error. WTF 😆

I had the exact same thing. I solved it by removing the Augury plugin.

@jeroensneyers - Your suggestion worked! Augury has always felt incredibly shoddy. Thanks for mentioning it!

Same trouble on chrome , i remove augury and its working ...

@jeroensneyers Thanks man! After removing augury, problem was solved.

Yep thanks @jeroensneyers , angury , indeed, is the culprit

Augury... 👎

For our team it was the Augury plugin, and even reverted our code to a working stance to prove it.

Augury rolled back to 1.16.0 until this issue is resolved.
1.16.3 is a rollback release.

Thanks @jeroensneyers, same trouble here: augury removed and problem solved.

@jeroensneyers saved my day! thank you!!

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

Was this page helpful?
0 / 5 - 0 ratings