ngx-cookies同意抛出错误通用类型'ModuleWithProviders <T>'需要1个类型参数

问题描述

我正在使用Angular 10,并尝试使用ngx-cookiesconsent软件包。我从ngx-cookieconsent收到错误消息:

ERROR in node_modules/ngx-cookieconsent/cookieconsent.module.d.ts:7:53 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
    
 static forRoot(config: NgcCookieConsentConfig): ModuleWithProviders;

我相信我已经正确地将它连接到了app.module.ts文件中,如下所示:

imports: [
    NgcCookieConsentModule.forRoot(cookieConfig),BrowserModule,AppRoutingModule,BrowserAnimationsModule,LayoutModule,MaterialModule,HttpClientModule,AccountModule
  ],

ngx-cookieconsent确实正确声明了该方法(在版本2.2.3中),如https://github.com/tinesoft/ngx-cookieconsent/blob/master/src/cookieconsent.module.ts所示。

我做错什么了吗?

解决方法

我知道了。我的angular.json文件中没有正确的路径。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...