question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ugraded to Angular 9: Error: Can't resolve all parameters for ApplicationModule: (?).

See original GitHub issue

I upgraded my app to Angular 9 & am getting the following error:

Error: Can't resolve all parameters for ApplicationModule: (?).
    at syntaxError (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:7582:17)
    at CompileMetadataResolver._getDependenciesMetadata (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:27327:35)
    at CompileMetadataResolver._getTypeMetadata (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:27219:26)
    at CompileMetadataResolver.getNgModuleMetadata (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:27087:24)
    at CompileMetadataResolver.getNgModuleSummary (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:26889:35)
    at /home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:27008:51
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.getNgModuleMetadata (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:26996:49)
    at CompileMetadataResolver.getNgModuleSummary (/home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:26889:35)
    at /home/brian/work/dishzilla/menus-angular-2-app/apps/angular-app/dist/server.js:26981:55

I have spent hours debugging this issue, but still have not made progress. I’ve also seen a number of fixes for this error message in previous years but none of those solutions worked for me. Can you please advise on obtaining a better error message that is easier to debug, because this error message is not very helpful. Thank you

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:29 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
celestekingcommented, Oct 20, 2020

In my case (Angular 6 -> 6.1 LTS upgrade), it was because some idiot added window.global = {window}; to index.html. Removing that cleared the error. Spent 4 hours trying to track this down. Angular sucks.

5reactions
btakitacommented, Mar 8, 2020

@AndrewKushnir Unfortunately, I cannot provide a simple reproduction due to the complexity of the app. I added some logging statements & noticed that when ReflectionCapabilities.prototype._ownParameters is invoked on the ApplicationModule reflection type, the logic falls through to the If a class has no decorators, at least create metadata case. [ undefined ] is returned since the constructor has an arity of 1.

https://github.com/angular/angular/blob/master/packages/core/src/reflection/reflection_capabilities.ts#L123

When @angular/core/fesm5/core.js is loaded. Here is the definition of ApplicationModule in that file.

var ApplicationModule = /** @class */ (function () {
    // Inject ApplicationRef to make it eager...
    function ApplicationModule(appRef) {
    }
    ApplicationModule = __decorate([
        NgModule({ providers: APPLICATION_MODULE_PROVIDERS }),
        __metadata("design:paramtypes", [ApplicationRef])
    ], ApplicationModule);
    return ApplicationModule;
}());

I’m not familiar with how to access the source of the ApplicationModule type object, as directly mutating ApplicationModule does not seem carry over to the type object passed to ReflectionCapabilities.prototype._ownParameters.

One thing I hope to get out of this issue is to identify the source of the problem & to have an error that directly notifies the programmer of the cause of the error.

I thought ivy was enabled by default on Angular 9. I admit that I don’t use Angular for most of my projects so I’m a bit out of the loop with the evolution of Angular & it’s various architectural updates. I’ll investigate if Ivy is being used…


@ericmartinezr I noticed that you gave a thumbs down on this issue. I’d love to provide more detail about the reproduction, but I’ve been spending > 6 hours trying to identify the issue. Is this not an area that can be improved or am I supposed to “suck it up” & pretend that everything is ok or something like that? I’d rather there be a quicker way to fix this problem without the need to file an issue in the first place. Since this same error has been reoccurring for years (since v2), with multi-hour debug sessions, is this not an area that can be improved to help developers?

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - Can't resolve all parameters for ApplicationModule
There is no Application Module . I found out what the error was, I'm going to post it in an answer. – Alavaros....
Read more >
Fixing the "can't resolve all parameters" exception with ...
Here's what the error looked like: Can't resolve all parameters for QuillConfigurationDirective: [object Object], (?). The (?) indicates that ...
Read more >
NgModule FAQ - Angular
NgModules help organize an application into cohesive blocks of functionality. This page answers the questions many developers ask about NgModule design and ...
Read more >
Can't resolve all parameters for component in Angular
Sometimes you can get this error while running tests or in the browser console. Also, you can face this error after updating the...
Read more >
angular 4 pass parameter to service, uncaught error can t resolve all ...
The Angular adds the map all the route parameters in the ParamMap object, which can be ... uncaught error can t resolve all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found