运行 ng 服务 Angular5 时出错

Error when running ng serve Angular5

我是运行我的angular5项目用ng serve,然后出现这样的错误:

ERROR in node_modules/@ng-bootstrap/ng-bootstrap/buttons/radio.d.ts(58,96): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-input.d.ts(121,67): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.d.ts(115,208): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.d.ts(12,45): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.d.ts(29,45): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/dropdown/dropdown.d.ts(37,44): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-window.d.ts(14,40): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.d.ts(11,27): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.d.ts(70,30): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.d.ts(9,27): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.d.ts(54,30): error TS2315: Type 'ElementRef' is not generic. node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.d.ts(94,30): error TS2315: Type 'ElementRef' is not generic.

尝试重新安装 ng-bootstrap

你可以卸载ng-bootstrap npm uninstall @ng-bootstrap/ng-bootstrap
然后安装 ng-bootstrap npm install --save @ng-bootstrap/ng-bootstrap@2.0.0

希望对你有所帮助,祝你好运。