error TS2307: Cannot find module '@angular/cor

2020-02-11 04:18发布

问题:

So I get the following error when I tried building my application again:

ERROR in ../../../node_modules/@angular/cdk/a11y/typings/aria-describer/aria-describer.d.ts(8,42): error TS2307: Cannot find module '@angular/core

This error occurred while I was developing my angular application. I apparently got this whilst I was programming but I didn't notice it because the application simply just kept compiling whenever I made some changes. This error only started to prevented me from building the application this morning. Does anybody know what is going on here?

full error:

ERROR in ../../../node_modules/@angular/cdk/a11y/typings/aria-describer/aria-describer.d.ts(8,42): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/a11y/typings/focus-monitor/focus-monitor.d.ts(9,82): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/a11y/typings/focus-monitor/focus-monitor.d.ts(10,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/a11y/typings/focus-trap/focus-trap.d.ts(8,65): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/a11y/typings/key-manager/list-key-manager.d.ts(8,27): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/a11y/typings/key-manager/list-key-manager.d.ts(9,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/cdk/a11y/typings/live-announcer/live-announcer.d.ts(8,53): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/accordion/typings/accordion-item.d.ts(8,60): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/bidi/typings/dir.d.ts(8,59): error TS2307: Cannot find module '@angular/core'.




../../../node_modules/@angular/cdk/bidi/typings/directionality.d.ts(8,46): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/collections/typings/collection-viewer.d.ts(8,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/collections/typings/data-source.d.ts(8,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/collections/typings/selection.d.ts(8,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/cdk/collections/typings/unique-selection-dispatcher.d.ts(8,37): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/layout/typings/breakpoints-observer.d.ts(8,35): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/layout/typings/breakpoints-observer.d.ts(10,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/overlay/typings/keyboard/overlay-keyboard-dispatcher.d.ts(8,53): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/overlay-container.d.ts(8,53): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/overlay-directives.d.ts(9,126): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/overlay-module.d.ts(1,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(10,55): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(11,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(12,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/cdk/overlay/typings/overlay.d.ts(8,76): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/position/connected-position-strategy.d.ts(9,28): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/position/connected-position-strategy.d.ts(12,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/overlay/typings/position/overlay-position-builder.d.ts(8,28): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/scroll/close-scroll-strategy.d.ts(8,24): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/scroll/reposition-scroll-strategy.d.ts(8,24): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/overlay/typings/scroll/scroll-strategy-options.d.ts(8,24): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/portal/typings/dom-portal-outlet.d.ts(8,99): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/portal/typings/portal-directives.d.ts(8,137): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/portal/typings/portal-injector.d.ts(8,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/portal/typings/portal.d.ts(8,100): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/scrolling/typings/scroll-dispatcher.d.ts(8,57): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/scrolling/typings/scroll-dispatcher.d.ts(10,30): error TS2307: Cannot find module 'rxjs/Subscription'.
../../../node_modules/@angular/cdk/scrolling/typings/scroll-dispatcher.d.ts(11,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/scrolling/typings/scrollable.d.ts(8,55): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/scrolling/typings/scrollable.d.ts(9,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/scrolling/typings/viewport-ruler.d.ts(8,45): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/scrolling/typings/viewport-ruler.d.ts(10,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/cdk/stepper/typings/step-label.d.ts(8,29): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/stepper/typings/stepper.d.ts(8,107): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/stepper/typings/stepper.d.ts(10,33): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/cdk/stepper/typings/stepper.d.ts(12,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/cdk/table/typings/cell.d.ts(8,41): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/table/typings/row.d.ts(8,112): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/table/typings/table.d.ts(8,139): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/cdk/table/typings/table.d.ts(11,33): error TS2307: Cannot find module 'rxjs/BehaviorSubject'.
../../../node_modules/@angular/cdk/table/typings/table.d.ts(13,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(10,100): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(11,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(14,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/autocomplete/typings/autocomplete.d.ts(8,119): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(10,91): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(11,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/button/typings/button.d.ts(10,39): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/checkbox/typings/checkbox-config.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/checkbox/typings/checkbox-required-validator.d.ts(8,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/checkbox/typings/checkbox-required-validator.d.ts(9,43): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/checkbox/typings/checkbox.d.ts(9,87): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/checkbox/typings/checkbox.d.ts(10,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/chips/typings/chip-input.d.ts(1,42): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/chips/typings/chip-list.d.ts(11,118): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/chips/typings/chip-list.d.ts(12,77): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/chips/typings/chip-list.d.ts(15,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/chips/typings/chip.d.ts(9,53): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/chips/typings/chip.d.ts(11,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/core/typings/common-behaviors/color.d.ts(9,28): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/common-behaviors/common-module.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/common-behaviors/error-state.d.ts(10,55): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/core/typings/common-behaviors/error-state.d.ts(11,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/core/typings/common-behaviors/initialized.d.ts(9,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts(9,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/core/typings/datetime/date-adapter.d.ts(10,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/core/typings/datetime/date-formats.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/error/error-options.d.ts(1,57): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/core/typings/gestures/gesture-config.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/gestures/gesture-config.d.ts(9,37): error TS2307: Cannot find module '@angular/platform-browser'.
../../../node_modules/@angular/material/core/typings/label/label-options.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/line/line.d.ts(8,39): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/option/option.d.ts(1,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/core/typings/option/option.d.ts(2,106): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/ripple/ripple-renderer.d.ts(8,36): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/core/typings/ripple/ripple.d.ts(9,71): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/calendar-body.d.ts(8,30): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/calendar.d.ts(1,124): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/datepicker-input.d.ts(1,71): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/datepicker-input.d.ts(2,84): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/datepicker/typings/datepicker-intl.d.ts(1,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/datepicker/typings/datepicker-toggle.d.ts(1,90): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/datepicker.d.ts(10,101): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/datepicker.d.ts(13,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/datepicker/typings/month-view.d.ts(8,67): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/multi-year-view.d.ts(8,67): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/datepicker/typings/year-view.d.ts(8,67): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/dialog/typings/dialog-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/dialog/typings/dialog-config.d.ts(8,34): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/dialog/typings/dialog-container.d.ts(8,92): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/dialog/typings/dialog-container.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/dialog/typings/dialog-content-directives.d.ts(8,62): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/dialog/typings/dialog-ref.d.ts(9,26): error TS2307: Cannot find module '@angular/common'.
../../../node_modules/@angular/material/dialog/typings/dialog-ref.d.ts(11,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/dialog/typings/dialog.d.ts(3,26): error TS2307: Cannot find module '@angular/common'.
../../../node_modules/@angular/material/dialog/typings/dialog.d.ts(4,55): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/dialog/typings/dialog.d.ts(5,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/dialog/typings/dialog.d.ts(6,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/expansion/typings/expansion-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/expansion/typings/expansion-panel-content.d.ts(8,29): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/expansion/typings/expansion-panel-header.d.ts(9,58): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(8,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(9,108): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(13,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/form-field/typings/form-field-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/form-field/typings/form-field-control.d.ts(8,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/form-field/typings/form-field-control.d.ts(9,27): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/form-field/typings/form-field.d.ts(1,112): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/grid-list/typings/grid-list.d.ts(8,68): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/grid-list/typings/grid-tile.d.ts(8,57): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/icon/typings/icon-registry.d.ts(1,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/icon/typings/icon-registry.d.ts(2,28): error TS2307: Cannot find module '@angular/common/http'.
../../../node_modules/@angular/material/icon/typings/icon-registry.d.ts(3,47): error TS2307: Cannot find module '@angular/platform-browser'.
../../../node_modules/@angular/material/icon/typings/icon-registry.d.ts(4,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/icon/typings/icon.d.ts(1,62): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/input/typings/autosize.d.ts(8,71): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/input/typings/input-value-accessor.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/input/typings/input.d.ts(2,59): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/input/typings/input.d.ts(3,55): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/input/typings/input.d.ts(6,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/list/typings/list.d.ts(8,57): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/list/typings/selection-list.d.ts(10,109): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/list/typings/selection-list.d.ts(12,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/menu/typings/menu-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/menu/typings/menu-content.d.ts(8,110): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/menu/typings/menu-directive.d.ts(8,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/menu/typings/menu-directive.d.ts(10,119): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/menu/typings/menu-directive.d.ts(11,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/menu/typings/menu-item.d.ts(9,39): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/menu/typings/menu-item.d.ts(11,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/menu/typings/menu-panel.d.ts(8,43): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/menu/typings/menu-trigger.d.ts(3,105): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/paginator/typings/paginator-intl.d.ts(8,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/paginator/typings/paginator-intl.d.ts(9,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/paginator/typings/paginator.d.ts(1,68): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/progress-bar/typings/progress-bar.d.ts(8,28): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/progress-spinner/typings/progress-spinner.d.ts(8,54): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/radio/typings/radio.d.ts(10,124): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/radio/typings/radio.d.ts(11,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/select/typings/select-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/select/typings/select.d.ts(12,168): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/select/typings/select.d.ts(13,77): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/select/typings/select.d.ts(16,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/sidenav/typings/drawer-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/sidenav/typings/drawer.d.ts(8,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/sidenav/typings/drawer.d.ts(12,146): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/sidenav/typings/drawer.d.ts(13,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/sidenav/typings/drawer.d.ts(14,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/sidenav/typings/sidenav.d.ts(8,46): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(10,90): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(11,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/slider/typings/slider.d.ts(10,80): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/slider/typings/slider.d.ts(11,38): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-config.d.ts(8,50): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(8,97): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(11,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(12,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar-ref.d.ts(9,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/snack-bar/typings/snack-bar.d.ts(12,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/sort/typings/sort-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/sort/typings/sort-header-intl.d.ts(8,26): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/sort/typings/sort-header-intl.d.ts(9,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/sort/typings/sort-header.d.ts(8,35): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/sort/typings/sort.d.ts(8,52): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/sort/typings/sort.d.ts(11,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/stepper/typings/step-header.d.ts(9,71): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/stepper/typings/step-label.d.ts(8,29): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/stepper/typings/stepper-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/stepper/typings/stepper-icon.d.ts(8,29): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/stepper/typings/stepper-intl.d.ts(1,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/stepper/typings/stepper.d.ts(10,89): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/stepper/typings/stepper.d.ts(11,57): error TS2307: Cannot find module '@angular/forms'.
../../../node_modules/@angular/material/table/typings/cell.d.ts(8,28): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/table/typings/table-data-source.d.ts(9,33): error TS2307: Cannot find module 'rxjs/BehaviorSubject'.
../../../node_modules/@angular/material/table/typings/table-data-source.d.ts(12,30): error TS2307: Cannot find module 'rxjs/Subscription'.
../../../node_modules/@angular/material/tabs/typings/ink-bar.d.ts(8,36): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab-body.d.ts(8,105): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab-body.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/tabs/typings/tab-group.d.ts(8,122): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab-header.d.ts(9,122): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab-label-wrapper.d.ts(8,28): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab-label.d.ts(8,47): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab-nav-bar/tab-nav-bar.d.ts(11,95): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab.d.ts(9,92): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tabs/typings/tab.d.ts(11,25): error TS2307: Cannot find module 'rxjs/Subject'.
../../../node_modules/@angular/material/tabs/typings/tabs-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/toolbar/typings/toolbar.d.ts(8,54): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tooltip/typings/tooltip-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/tooltip/typings/tooltip.d.ts(8,32): error TS2307: Cannot find module '@angular/animations'.
../../../node_modules/@angular/material/tooltip/typings/tooltip.d.ts(14,100): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/material/tooltip/typings/tooltip.d.ts(15,28): error TS2307: Cannot find module 'rxjs/Observable'.
../../../node_modules/@angular/material/typings/version.d.ts(8,25): error TS2307: Cannot find module '@angular/core'.

I'm clueless at this point. Can someone please help me out?

package.json: https://pastebin.com/GzfVg1cs

回答1:

This problem apparently was being caused by the CDK and material modules of angular. I don't exactly know how it happend but I fixed it.

I fixed it by following an answer in this github issue: https://github.com/angular/material2/issues/8306

Solution

To fix this issue you have to run the following commands:

npm install --save @angular/material @angular/cdk
rm -rf node_modules
npm install


回答2:

I see that some solutions are radical, I would not to try that in the first place. My solution was not radical, and it did the job.

I had the problem too, I did a simple npm update This was what came out:

$> npm update
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ rxjs@6.2.2
+ core-js@2.5.7
added 2 packages from 6 contributors and audited 38996 packages in 13.315s
found 0 vulnerabilities

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @types/jasminewd2@2.0.4
updated 1 package and audited 38996 packages in 12.972s
found 0 vulnerabilities

And it solved the problem.



回答3:

For me problem got resolved when I make sure that @angular/material, @angular/ckd and @angular/animations versions are compatible with @angular/core version. Just edit package.json.

In my case:

"@angular/core": "^7.2.15",
"@angular/animations": "^7.2.15",
"@angular/material": "^7.3.3",
"@angular/cdk": "^7.3.7",  


回答4:

In order to fix this issue you have to update to Angular CLI version, as @angular cdk 6.0 requires @angular core 6.0 version(updated version). Try to use updated version for both CLI and material/CDK

Follow these steps:-

npm uninstall -g @angular/cli
npm cache verify

if npm version is less than 5 then use npm cache clean

npm install -g @angular/cli@latest

then create new angluar/cli project after that install @angular/material and @angular/cdk.

I hope this will solve your problem.