我在 Angular 应用程序中安装了 Material UI 现在我收到错误没有导出成员 Observable 错误,

我删除了节点模块并重新安装,问题仍然存在

ERROR in node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(14,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/chips/typings/chip-list.d.ts(15,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/chips/typings/chip.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/core/typings/common-behaviors/error-state.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/core/typings/common-behaviors/initialized.d.ts(9,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts(9,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts(10,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/core/typings/option/option.d.ts(1,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/datepicker/typings/datepicker-intl.d.ts(1,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/datepicker/typings/datepicker.d.ts(13,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/dialog/typings/dialog-ref.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/dialog/typings/dialog.d.ts(5,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported
member 'Observable'.
node_modules/@angular/material/dialog/typings/dialog.d.ts(6,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(13,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/form-field/typings/form-field-control.d.ts(8,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"'
has no exported member 'Observable'.
node_modules/@angular/material/icon/typings/icon-registry.d.ts(4,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/input/typings/input.d.ts(6,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/menu/typings/menu-directive.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/menu/typings/menu-item.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/paginator/typings/paginator-intl.d.ts(9,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/select/typings/select.d.ts(16,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/sidenav/typings/drawer.d.ts(13,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/sidenav/typings/drawer.d.ts(14,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(12,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/snack-bar/typings/snack-bar-ref.d.ts(9,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@angular/material/sort/typings/sort-header-intl.d.ts(9,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/sort/typings/sort.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/stepper/typings/stepper-intl.d.ts(1,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@angular/material/stepper/typings/stepper.d.ts(28,5): error TS2416: Property '_stepHeader' in type 'MatStepper' is not assignable to the same property in base type 'CdkStepper'.
  Type 'QueryList<ElementRef<any>>' is not assignable to type 'QueryList<FocusableOption>'.
    Property 'focus' is missing in type 'ElementRef<any>' but required in type 'FocusableOption'.
node_modules/@angular/material/table/typings/table-data-source.d.ts(9,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@angular/material/table/typings/table-data-source.d.ts(12,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subscription"' has no exported member 'Subscription'.
node_modules/@angular/material/tabs/typings/tab.d.ts(11,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Subject"' has no exported member
'Subject'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(15,10): error TS2305: Module '"D:/angular2/ang/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/rxjs/Subject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subject'.
node_modules/rxjs/Subscription.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscription'.

我想成功运行我的应用程序

最佳答案

这可能是版本问题

import { Subject } from 'rxjs/Subject'

变成
import {  Subject } from 'rxjs'

为了支持第一个导入样式,rxjs 提供了 rxjs-compat 包。

关于angular - node_modules/rxjs/Subject "' has no exported member ' 主题',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56713290/

10-13 07:26