'@ angular / core'中找不到导出'Renderer2'

时间:2017-08-25 11:29:58

标签: angular typescript visual-studio-code angular-material2

我在Angular项目中安装了角度材质。我已经按照Material documentation中给出的所有步骤进行了操作,但是当我尝试使用'npm start'运行应用程序时,我收到了与InjectionToken和Renderer2相关的警告和错误。

我在控制台中收到的错误消息:

WARNING in ./~/@angular/material/@angular/material.es5.js 138:33-47 "export 'InjectionToken' was not found in '@angular/core'
WARNING in ./~/@angular/material/@angular/material.es5.js 826:35-49 "export 'InjectionToken' was not found in '@angular/core'
WARNING in ./~/@angular/material/@angular/material.es5.js 1010:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@angular/material/@angular/material.es5.js 1388:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@angular/material/@angular/material.es5.js 3177:12-21 "export 'Renderer2' was not found in '@angular/core'
ERROR in C:/Users/naray/MEAN-project/client/node_modules/@angular/cdk/typings/bidi/directionality.d.ts (8,34): Module '"C:/Users/naray/MEAN-project/client/node_mo dules/@angular/core/index"' has no exported member 'InjectionToken'.
ERROR in C:/Users/naray/MEAN-project/client/node_modules/@angular/cdk/typings/table/cell.d.ts (8,22): Module '"C:/Users/naray/MEAN-project/client/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
ERROR in C:/Users/naray/MEAN-project/client/node_modules/@angular/cdk/typings/table/row.d.ts (28,31): Type'IterableDiffer' is not generic.
ERROR in C:/Users/naray/MEAN-project/client/node_modules/@angular/cdk/typings/table/table.d.ts (8,69): Module '"C:/Users/naray/MEAN-project/client/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
ERROR in C:/Users/naray/MEAN-project/client/node_modules/@angular/cdk/typings/table/table.d.ts (8,80): Module '"C:/Users/naray/MEAN-project/client/node_modules/@angular/core/index"' has no exported member 'TrackByFunction'.
ERROR in C:/Users/naray/MEAN-project/client/node_modules/@angular/material/typings/core/overlay/scroll/scrollable.d.ts (8,49): Module '"C:/Users/naray/MEAN-project/client/node_modules/@angular/core/index"' has no exported member 'Renderer2'.

1 个答案:

答案 0 :(得分:1)

在package.json中,我同时引用了@ ionic / angular和ionic-angular。

ionic-angular似乎已被弃用并替换为@ ionic / angular,因此当我安装ionic-angular时,此操作解决了该错误。