首页 > 解决方案 > Angular Material : MatAutocompleteModule 的 NgModule.exports 中位置 3 的值不是参考值 无法静态确定

问题描述

在 Angular 中进行更改时,出现以下错误:

Angular 材料被用于创建聊天功能。

ERROR in Failed to compile entry-point @angular/material/autocomplete (`module` as esm2015) due to compilation errors:
    node_modules/@angular/material/fesm2015/autocomplete.js:897:26 - error NG1010: Value at position 3 in the NgModule.exports of MatAutocompleteModule is not a reference
  Value could not be determined statically.

897                 exports: [
                             ~
898                     MatAutocomplete,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
903                     MatCommonModule,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
904                 ],
    ~~~~~~~~~~~~~~~~~

  node_modules/@angular/material/fesm2015/autocomplete.js:901:21
    901                     CdkScrollableModule,
                            ~~~~~~~~~~~~~~~~~~~
    Unknown reference.


    ERROR in node_modules/@angular/material/stepper/stepper.d.ts:36:14 - error TS2610: 'steps' is defined as an accessor in class 'CdkStepper', but is overridden here in 'MatStepper' as an instance property.

    36     readonly steps: QueryList<MatStep>;
                    ~~~~~
    node_modules/@angular/material/table/row.d.ts:9:91 - error TS2305: Module '"d:/git/whatsapp/pl4whatsapp-web/frontend/node_modules/@angular/cdk/table"' has no exported member 'CdkNoDataRow'.

    9 import { CdkFooterRow, CdkFooterRowDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef, CdkNoDataRow } from '@angular/cdk/table';
                                                                                                ~~~~~~~~~~~~
    node_modules/ngx-smart-modal/src/modules/ngx-smart-modal.module.d.ts:8:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

    8     static forRoot(): ModuleWithProviders;
                            ~~~~~~~~~~~~~~~~~~~
    node_modules/ngx-smart-modal/src/modules/ngx-smart-modal.module.d.ts:12:24 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

    12     static forChild(): ModuleWithProviders;
                          ~~~~~~~~~~~~~~~~~~~

我的 Angular 应用程序的 package.json 如下:-

是与 Angular Google 材料相关的问题。

{
  "name": "my-app",
  "version": "2.4.1",
  "license": "license-url",
  "repository": {
    "type": "git",
    "url": "git-url"
  },
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "1.1.0",
    "@angular/animations": "~12.1.4",
    "@angular/cdk": "~12.1.4",
    "@angular/common": "~12.1.4",
    "@angular/compiler": "~12.1.4",
    "@angular/core": "~12.1.4",
    "@angular/forms": "~12.1.4",
    "@angular/http": "7.2.16",
    "@angular/localize": "~12.1.4",
    "@angular/material": "~12.1.4",
    "@angular/platform-browser": "~12.1.4",
    "@angular/platform-browser-dynamic": "~12.1.4",
    "@angular/platform-server": "~12.1.4",
    "@angular/router": "~12.1.4",
    "@ng-bootstrap/ng-bootstrap": "^9.1.1",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@stomp/stompjs": "^6.1.2",
    "ajv": "6.11.0",
    "angular-calendar": "0.28.2",
    "angular-file-uploader": "^7.0.3",
    "angular2-chartjs": "^0.5.1",
    "animate.css": "3.7.2",
    "arrive": "2.4.1",
    "bootstrap": "4.4.1",
    "bootstrap-material-design": "4.1.2",
    "bootstrap-notify": "3.1.3",
    "bootstrap-rtl": "3.3.4",
    "bootstrap-select": "1.13.12",
    "bootstrap-tagsinput": "0.7.1",
    "chartist": "0.11.4",
    "chartist-plugin-zoom": "0.6.0",
    "core-js": "3.6.4",
    "cors": "^2.8.5",
    "datatables": "1.10.18",
    "datatables.net-bs4": "1.10.20",
    "datatables.net-responsive": "2.2.3",
    "fullcalendar": "3.10.1",
    "googleapis": "47.0.0",
    "hammerjs": "2.0.8",
    "jasny-bootstrap": "4.0.0",
    "jquery": "3.4.1",
    "jquery-ui": "^1.12.1",
    "jquery-validation": "1.19.1",
    "jqvmap": "1.5.1",
    "moment": "2.24.0",
    "moment-timezone": "0.5.27",
    "ng2-file-upload": "^1.4.0",
    "ng2-nouislider": "1.8.2",
    "ng2-select": "2.0.0",
    "ngx-chips": "2.1.0",
    "ngx-infinite-scroll": "^10.0.1",
    "ngx-owl-carousel-o": "^6.0.0",
    "ngx-perfect-scrollbar": "^10.1.1",
    "ngx-smart-modal": "^7.4.1",
    "nouislider": "14.1.1",
    "perfect-scrollbar": "1.5.0",
    "popper.js": "1.16.1",
    "rxjs": "6.5.4",
    "rxjs-compat": "6.5.4",
    "save": "^2.4.0",
    "sweetalert2": "7.22.2",
    "time-ago-pipe": "^1.3.2",
    "twitter-bootstrap-wizard": "1.2.0",
    "uglify-js": "3.7.7",
    "validate": "5.1.0",
    "web-animations-js": "2.3.2",
    "zone.js": "0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.900.2",
    "@angular/cli": "~11.2.14",
    "@angular/compiler-cli": "~11.2.14",
    "@types/bootstrap": "4.3.1",
    "@types/chartist": "0.9.47",
    "@types/jasmine": "3.5.4",
    "@types/jquery": "3.3.32",
    "@types/node": "13.7.1",
    "codelyzer": "5.2.1",
    "jasmine-core": "3.5.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "4.4.1",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "2.0.0",
    "karma-coverage-istanbul-reporter": "2.1.1",
    "karma-jasmine": "3.1.1",
    "karma-jasmine-html-reporter": "1.5.2",
    "protractor": "5.4.3",
    "ts-node": "8.6.2",
    "tslint": "6.0.0",
    "typescript": "~4.1.6"
  }
}

我试图在安装 stomp 后稳定 package.json,但 ng serve 给出了错误。我需要降级 Angular 版本吗?有什么解决方法吗?

标签: angularangularjsangular-material

解决方案


推荐阅读