Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: this.getExtraNgModuleProviders is not a function

I am working on a repository that keeps throwing this error on the console: Uncaught TypeError: this.getExtraNgModuleProviders is not a function.

The projects compiles fine on "ng serve" but it shows a blank page and that error on the console. I have tried many things but I couldn't find a way out.

I have tried uninstalling and installing @angular/compiler but didn't work. The problem seems to be with JitCompiler not finding this.getExtraNgModuleProviders

I think the function this.getExtraNgModuleProviders in the JitCompiler should be this._getExtraNgModuleProviders instead on the compiler.js. Since all the functions around it seem to include the underscore.

UPDATE:

I don't think the function name has anything to do with it since other developers can run the project fine and they have the same Jit compiler.js file. For reference: This is where it takes me when I click the error on the console

 function JitCompiler(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _compilerConfig, _console, getExtraNgModuleProviders) {
            this._metadataResolver = _metadataResolver;
            this._templateParser = _templateParser;
            this._styleCompiler = _styleCompiler;
            this._viewCompiler = _viewCompiler;
            this._ngModuleCompiler = _ngModuleCompiler;
            this._summaryResolver = _summaryResolver;
            this._reflector = _reflector;
            this._compilerConfig = _compilerConfig;
            this._console = _console;
            this.getExtraNgModuleProviders = getExtraNgModuleProviders;//<- error is pointed here
            this._compiledTemplateCache = new Map();
            this._compiledHostTemplateCache = new Map();
            this._compiledDirectiveWrapperCache = new Map();
            this._compiledNgModuleCache = new Map();
            this._sharedStylesheetCount = 0;
            this._addedAotSummaries = new Set();
        }

All other developers have the same compiler.js as mine.

Any help will be appreciated.

like image 352
Andrew George Avatar asked Jun 24 '19 17:06

Andrew George


1 Answers

I just did the following and the error was resolved. It is because of version incompatibility of your @angular/platform-browser-dynamic.

npm uninstall @angular/platform-browser-dynamic

npm install @angular/platform-browser-dynamic
like image 169
Sandeep Alla Avatar answered Oct 13 '22 06:10

Sandeep Alla