Uncaught TypeError: this.getExtraNgModuleProviders is not a function

Uncaught TypeError: this.getExtraNgModuleProviders is not a function

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

项目在 "ng serve" 上编译正常,但它显示空白页面,并且在控制台上显示该错误。我尝试了很多东西,但找不到出路。

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

我认为JitCompiler中的函数this.getExtraNgModuleProviders应该是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();
        }

所有其他开发者都和我一样compiler.js。

任何帮助将不胜感激。

我认为您的 angular/platform-browser-dynamic 未更新。像这样改变你的package.json;

"@angular/platform-browser-dynamic": "~8.0.0"

删除节点模块后 运行 "npm install" .

希望对您有所帮助。

有同样的错误信息。我们在 angular.

中使用 .net 核心

ng build 工作完美,但是从 VS 开始抛出 Uncaught TypeError: this.getExtraNgModuleProviders is not a function 异常。

我可以用我们的存储库的新克隆来解决这个问题,可能是 VS 缓存中的某些东西导致了这个问题。

我只是做了以下操作,错误就解决了。这是因为你的@angular/platform-browser-dynamic.

版本不兼容
npm uninstall @angular/platform-browser-dynamic

npm install @angular/platform-browser-dynamic