未捕获的类型错误:this.getExtraNgModuleProviders 不是函数

And*_*rge 6 javascript jit angular angular6 angular7

我正在处理一个不断在控制台上抛出此错误的存储库: Uncaught TypeError: this.getExtraNgModuleProviders is not a function.

这些项目在“ng serve”上编译得很好,但它在控制台上显示一个空白页面和那个错误。我尝试了很多事情,但我找不到出路。

我试过卸载和安装@angular/compiler,但没有用。问题似乎是 JitCompiler 没有找到this.getExtraNgModuleProviders

我认为this.getExtraNgModuleProvidersJitCompiler 中的函数应该this._getExtraNgModuleProviders在 compiler.js 上。因为它周围的所有功能似乎都包含下划线。

更新:

我不认为函数名称与它有任何关系,因为其他开发人员可以很好地运行该项目,并且他们拥有相同的 Jit compiler.js 文件。供参考:当我单击控制台上的错误时,这是​​我需要的地方

 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();
        }
Run Code Online (Sandbox Code Playgroud)

所有其他开发人员都拥有与我相同的 compiler.js。

任何帮助将不胜感激。

小智 3

我刚刚执行了以下操作,错误已解决。这是因为您的 @angular/platform-b​​rowser-dynamic 版本不兼容。

npm uninstall @angular/platform-browser-dynamic

npm install @angular/platform-browser-dynamic
Run Code Online (Sandbox Code Playgroud)