我的项目基于Angular CLI 1.7.4构建 运行命令“ ng serve”时,出现以下错误: 我了解这是因为项目中缺少角形材料。 请指导我哪种角材料版本最适合我的项目。 请在下面找到错误消息:
ERROR in node_modules/@angular/flex-layout/flex/typings/flex-offset/flex-offset.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/flex-layout/flex/typings/layout-gap/layout-gap.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(8,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(9,41): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/autocomplete/typings/autocomplete.d.ts(10,44): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(9,43): error TS2307: Cannot find module '@angular/cdk/collections'.
node_modules/@angular/material/button/typings/button.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/button/typings/button.d.ts(9,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/checkbox/typings/checkbox.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/chips/typings/chip-list.d.ts(8,33): error TS2307: Cannot find module '@angular/cdk/a11y'.node_modules/@angular/material/chips/typings/chip-list.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/bidi'.node_modules/@angular/material/chips/typings/chip-list.d.ts(10,32): error TS2307: Cannot find module '@angular/cdk/collections'.
node_modules/@angular/material/chips/typings/chip.d.ts(8,33): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/core/typings/ripple/ripple-renderer.d.ts(9,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/core/typings/ripple/ripple.d.ts(8,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/datepicker/typings/calendar.d.ts(7,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/datepicker/typings/datepicker.d.ts(8,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/datepicker/typings/datepicker.d.ts(9,67): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/dialog/typings/dialog-config.d.ts(9,27): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/dialog/typings/dialog-config.d.ts(10,32): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/dialog/typings/dialog-container.d.ts(10,84): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/dialog/typings/dialog-container.d.ts(11,34): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/dialog/typings/dialog-ref.d.ts(8,28): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/dialog/typings/dialog.d.ts(1,59): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/dialog/typings/dialog.d.ts(2,31): error TS2307: Cannot find module '@angular/cdk/portal'.node_modules/@angular/material/expansion/typings/accordion.d.ts(1,30): error TS2307: Cannot find module '@angular/cdk/accordion'.
node_modules/@angular/material/expansion/typings/expansion-panel-header.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(10,34): error TS2307: Cannot find module '@angular/cdk/accordion'.
node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(11,43): error TS2307: Cannot find module '@angular/cdk/collections'.
node_modules/@angular/material/expansion/typings/expansion-panel.d.ts(12,32): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/grid-list/typings/grid-list.d.ts(10,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/input/typings/autosize.d.ts(9,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/input/typings/input.d.ts(1,26): error TS2307: Cannot find module '@angular/cdk/platform'.node_modules/@angular/material/list/typings/selection-list.d.ts(8,50): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/list/typings/selection-list.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/collections'.
node_modules/@angular/material/menu/typings/menu-directive.d.ts(9,27): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/menu/typings/menu-directive.d.ts(16,29): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/menu/typings/menu-item.d.ts(8,60): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/menu/typings/menu-panel.d.ts(10,27): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/menu/typings/menu-panel.d.ts(11,29): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/menu/typings/menu-trigger.d.ts(1,43): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/menu/typings/menu-trigger.d.ts(2,67): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/menu/typings/menu-trigger.d.ts(7,43): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/progress-spinner/typings/progress-spinner.d.ts(10,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/radio/typings/radio.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/radio/typings/radio.d.ts(9,43): error TS2307: Cannot find module '@angular/cdk/collections'.
node_modules/@angular/material/select/typings/select.d.ts(8,44): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/select/typings/select.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/select/typings/select.d.ts(10,32): error TS2307: Cannot find module '@angular/cdk/collections'.
node_modules/@angular/material/select/typings/select.d.ts(11,103): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/sidenav/typings/drawer.d.ts(9,61): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/sidenav/typings/drawer.d.ts(10,32): error TS2307: Cannot find module '@angular/cdk/bidi'.node_modules/@angular/material/sidenav/typings/drawer.d.ts(11,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/sidenav/typings/drawer.d.ts(15,31): error TS2307: Cannot find module '@angular/cdk/scrolling'.
node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(9,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/slider/typings/slider.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/slider/typings/slider.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/snack-bar/typings/snack-bar-config.d.ts(9,36): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/snack-bar/typings/snack-bar-config.d.ts(10,27): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/snack-bar/typings/snack-bar-container.d.ts(10,68): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/snack-bar/typings/snack-bar-ref.d.ts(8,28): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/snack-bar/typings/snack-bar.d.ts(8,31): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/snack-bar/typings/snack-bar.d.ts(9,36): error TS2307: Cannot find module '@angular/cdk/layout'.
node_modules/@angular/material/snack-bar/typings/snack-bar.d.ts(10,25): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/snack-bar/typings/snack-bar.d.ts(11,31): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/sort/typings/sort-header.d.ts(9,30): error TS2307: Cannot find module '@angular/cdk/table'.
node_modules/@angular/material/stepper/typings/step-header.d.ts(8,30): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/@angular/material/stepper/typings/step-label.d.ts(9,30): error TS2307: Cannot find module '@angular/cdk/stepper'.
node_modules/@angular/material/stepper/typings/stepper-button.d.ts(1,52): error TS2307: Cannot find module '@angular/cdk/stepper'.
node_modules/@angular/material/stepper/typings/stepper.d.ts(8,37): error TS2307: Cannot find module '@angular/cdk/stepper'.
node_modules/@angular/material/stepper/typings/stepper.d.ts(9,32): error TS2307: Cannot find module '@angular/cdk/bidi'.node_modules/@angular/material/table/typings/cell.d.ts(9,84): error TS2307: Cannot find module '@angular/cdk/table'.
node_modules/@angular/material/table/typings/row.d.ts(1,66): error TS2307: Cannot find module '@angular/cdk/table'.
node_modules/@angular/material/table/typings/table-data-source.d.ts(8,28): error TS2307: Cannot find module '@angular/cdk/table'.
node_modules/@angular/material/table/typings/table.d.ts(1,26): error TS2307: Cannot find module '@angular/cdk/table'.
node_modules/@angular/material/tabs/typings/tab-body.d.ts(10,49): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/tabs/typings/tab-body.d.ts(11,43): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/tabs/typings/tab-header.d.ts(8,43): error TS2307: Cannot find module '@angular/cdk/bidi'.node_modules/@angular/material/tabs/typings/tab-header.d.ts(13,31): error TS2307: Cannot find module '@angular/cdk/scrolling'.
node_modules/@angular/material/tabs/typings/tab-label.d.ts(9,27): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/tabs/typings/tab-nav-bar/tab-nav-bar.d.ts(8,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/tabs/typings/tab-nav-bar/tab-nav-bar.d.ts(9,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/tabs/typings/tab-nav-bar/tab-nav-bar.d.ts(10,31): error TS2307: Cannot find module '@angular/cdk/scrolling'.
node_modules/@angular/material/tabs/typings/tab.d.ts(8,32): error TS2307: Cannot find module '@angular/cdk/portal'.
node_modules/@angular/material/toolbar/typings/toolbar.d.ts(10,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(9,45): error TS2307: Cannot find module '@angular/cdk/a11y'.node_modules/@angular/material/tooltip/typings/tooltip.d.ts(10,32): error TS2307: Cannot find module '@angular/cdk/bidi'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(11,156): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(12,26): error TS2307: Cannot find module '@angular/cdk/platform'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(13,34): error TS2307: Cannot find module '@angular/cdk/scrolling'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(16,53): error TS2307: Cannot find module '@angular/cdk/layout'.
src/app/components/job-execution-report/job-execution-report.component.ts(19,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/job-execution-report/tasks-details-dialog.component.ts(3,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/job-summay-dialog/list-jobs.dialog.component.ts(9,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/list-jobs/list-jobs.component.ts(10,26): error TS2307: Cannot find module '@angular/cdk/collections'.src/app/components/list-tasks/list-tasks.component.ts(20,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/list-tasks/list-tasks.component.ts(21,21): error TS2307: Cannot find module '@angular/cdk/keycodes'.
src/app/components/list-tasks/list-tasks.dialog.component.ts(7,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/list-workflows/list-workflows-dialog.component.ts(4,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/list-workflows/list-workflows.component.ts(11,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/my-approvals/my-approvals.component.ts(11,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/my-team-requests/my-team-requests.component.ts(9,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/pending-scheduled-jobs/pending-scheduled-jobs.component.ts(10,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/profile/profile.component.ts(9,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/rfc-executions-report/rfc-execution-report.component.ts(4,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/run-summary-dialog/run-summary-dialog.component.ts(3,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/schedule-job/runtime-pause-config-dialog.component.ts(5,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/schedule-job/schedule-job.component.ts(1186,81): error TS2339: Property 'taskArgsValuesObj' does not exist on type '{}'.
src/app/components/team-requests/team-requests.component.ts(11,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/components/team-security/team-security.component.ts(15,26): error TS2307: Cannot find module '@angular/cdk/collections'.
src/app/modules/atom-ng-material.module.ts(33,30): error TS2307: Cannot find module '@angular/cdk/table'.
webpack: Failed to compile.
答案 0 :(得分:0)
npm安装
安装package.json内部所需的所有模块。
ng -v
检查您的Angular版本
您应该检查Angular而不是CLI版本,以检查应该安装哪个版本的Angular Material。
以下命令将使用正确的依赖项更新Angular项目,执行配置更改并执行初始化代码。
ng添加@ angular / material
对于Angular 5,您可以使用角材料5。执行以下命令以安装5.2.5版本的@ angular / material和@ angular / cdk:
npm install --save @angular/material@5.2.5
npm install --save @angular/cdk@5.2.5
答案 1 :(得分:0)
您只需要安装
npm install --save @angular/material@latest @angular/cdk@latest
不要担心它将安装最新版本和相同版本。
答案 2 :(得分:0)
最初,我的全局CLI是5的最新版本(7.1)和本地CLI版本。
同时安装角度CLI版本5的全局和本地CLI可以解决此问题。
请尝试以下评论:
npm uninstall @angular/cli
npm install -g @angular/cli@5.2.5