无法解析应用程序模块的所有参数:(?).在语法错误 (compiler.js:1021) 站点:stackoverflow.com [英] Can't resolve all parameters for Application Module: (?). at syntaxError (compiler.js:1021) site:stackoverflow.com

查看:17
本文介绍了无法解析应用程序模块的所有参数:(?).在语法错误 (compiler.js:1021) 站点:stackoverflow.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在@ngToolkit 的帮助下将我的 Angular 项目从版本 7 降级到 6 并集成 Angular Universal 后,我在浏览器控制台中收到以下错误消息:

After downgrading my Angular project from version 7 to 6 and integrating Angular Universal with the help of @ngToolkit, I'm getting the following error message in the browser console:

Can't resolve all parameters for Application Module: (?). at syntaxError (compiler.js:1021)

我通过简单地覆盖此处所述的依赖项来降级项目.如前所述,该错误仅发生在浏览器控制台中,而项目编译已成功完成.

I downgraded the project by simply overwriting the dependencies like described here. As already described the error only occurs in the browser console, while to compilation of the project is completing successfully.

推荐答案

你显然受到了 issue 26128 在 Angular 6.1.8 中引入.作为 IgorMinar 解释(强调我的):

You’re apparently affected by issue 26128 that was introduced in Angular 6.1.8. As IgorMinar explained (emphasis mine):

我注意到,过去在某些情况下,您可以在没有 Reflect.metadata polyfill 的情况下使用 JIT 编译器.但是最近有一个变化 [...],我们现在要求你在从 @angular/core 导入任何东西之前加载它.这将由 cli v7 自动完成,因此更改对大多数用户来说是透明的,除非您有自定义的 polyfill 设置,在这种情况下您需要确保polyfill 在 Angular 之前加载.

I noticed that in the past under certain circumstances you were able to use the JIT compiler without the Reflect.metadata polyfill. But with a recent change […], we now require you to load it before anything from @angular/core is imported. This will be done automatically by cli v7 so the change will be transparent to most users, unless you have a custom polyfill setup in which case you need to ensure that the polyfill is loaded before Angular.

如果是 Angular ^6.1.8 ||^7.0.0 使用 Webpack(即不是 Angular CLI),您必须导入 reflect-metadata(在任何 @angular/core 导入之前 - 如上所述).

In case of Angular ^6.1.8 || ^7.0.0 with Webpack (i.e. not Angular CLI), you have to import reflect-metadata (before any @angular/core imports—as stated above).

这篇关于无法解析应用程序模块的所有参数:(?).在语法错误 (compiler.js:1021) 站点:stackoverflow.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆