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

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

问题描述

在将Angular项目从版本7降级到6,并在@ngToolkit的帮助下将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.

对于带Webpack的Angular ^6.1.8 || ^7.0.0(即不是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天全站免登陆