【问题标题】:path/node_modules/@angular/router/router"' has no exported member 'QueryParamsHandling'path/node_modules/@angular/router/router"' 没有导出成员 'QueryParamsHandling'
【发布时间】:2020-03-12 09:45:35
【问题描述】:

当我构建项目时,问题发生了

错误

node_modules/@coreui/angular/lib/sidebar/app-sidebar-nav.d.ts(1,10) 中的错误:错误 TS2305:模块 '"C:/Users/amare/Desktop/New folder/tb /node_modules/@angular/router/router"' 没有导出成员 'QueryParamsHandling'。

package.json

  "name": "@coreui/coreui-free-angular-admin-template",
  "version": "2.4.5",
  "description": "CoreUI Free Angular 2+ Admin Template",
  "author": {
    "name": "Łukasz Holeczek",
    "url": "http://holeczek.pl",
    "github": "https://github.com/mrholek",
    "twitter": "https://twitter.com/lukaszholeczek"
  },
  "contributors": [
    {
      "name": "Andrzej Kopański",
      "url": "https://github.com/xidedix"
    }
  ],
  "homepage": "https://coreui.io/angular",
  "copyright": "Copyright 2018 creativeLabs Łukasz Holeczek",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod --aot --buildOptimizer --commonChunk --vendorChunk --optimization --progress",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.2.10",
    "@angular/common": "^7.2.10",
    "@angular/compiler": "^7.2.10",
    "@angular/core": "^7.2.10",
    "@angular/forms": "^7.2.10",
    "@angular/http": "^7.2.10",
    "@angular/platform-browser": "^7.2.10",
    "@angular/platform-browser-dynamic": "^7.2.10",
    "@angular/router": "^7.2.10",
    "@coreui/angular": "^2.4.5",
    "@coreui/coreui": "^2.1.8",
    "@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.3.1",
    "@coreui/icons": "0.3.0",
    "ag-grid-angular": "^20.2.0",
    "ag-grid-community": "^20.2.0",
    "angular-gauge-chart": "^0.6.0",
    "angular-jwt": "^0.1.11",
    "angular2-jwt": "^0.2.3",
    "bootstrap": "^4.3.1",
    "chart.js": "^2.8.0",
    "core-js": "^2.6.5",
    "file-saver": "^2.0.1",
    "flag-icon-css": "^3.3.0",
    "font-awesome": "^4.7.0",
    "jspdf": "^1.5.3",
    "jspdf-autotable": "^3.1.1",
    "moment": "^2.24.0",
    "mutationobserver-shim": "^0.3.3",
    "ng2-charts": "^1.6.0",
    "ngx-bootstrap": "^3.2.0",
    "ngx-perfect-scrollbar": "^7.2.1",
    "ngx-toastr": "^10.0.4",
    "rxjs": "^6.4.0",
    "simple-line-icons": "^2.4.1",
    "ts-helpers": "^1.1.2",
    "tsickle": "^0.34.3",
    "tslib": "^1.9.0",
    "xlsx": "^0.14.2",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.13.6",
    "@angular/cli": "^7.3.6",
    "@angular/compiler-cli": "^7.2.10",
    "@angular/language-service": "^7.2.10",
    "@types/jasmine": "^3.3.12",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "^11.11.4",
    "codelyzer": "^4.5.0",
    "jasmine-core": "^3.3.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^4.0.1",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "^2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "^5.4.2",
    "ts-node": "^8.0.3",
    "tslint": "^5.14.0",
    "typescript": "~3.2.4"
  },
  "engines": {
    "node": ">= 8.9.4",
    "npm": ">= 5.6.0"
  }
}

当我构建项目时,问题发生了

错误

node_modules/@coreui/angular/lib/sidebar/app-sidebar-nav.d.ts(1,10) 中的错误:错误 TS2305:模块 '"C:/Users/amare/Desktop/New folder/tb /node_modules/@angular/router/router"' 没有导出成员 'QueryParamsHandling'。

【问题讨论】:

  • 试试这个,删除node_modules文件夹并执行npm install
  • 它不工作

标签: angular


【解决方案1】:

更改 @coreui/angular 版本对我不起作用, 但将 node_modules\@coreui\angular\lib\sidebar\app-sidebar-nav.d.ts 文件中的 import 语句更改为:

import { QueryParamsHandling } from '@angular/router/src/config';

将立即生效。

【讨论】:

  • 当我尝试这个时,我得到这个错误:找不到模块'@angular/router/src/config'
  • 是的,我们得到'找不到模块'@angular/router/src/config'错误
【解决方案2】:

我也遇到了同样的问题,这对我有用。 使用这个版本的 coreui - "@coreui/angular": "2.5.3"

看起来 QueryParamsHandling 在此版本中未按此版本的代码引用。

另外,如果您已经运行 npm install,那么您需要手动删除它,然后使用 2.5.3 版本再次添加它,并确保您在 package.json 中提到了确切的版本(没有购物车或波浪号)。

【讨论】:

    【解决方案3】:

    我设法像这样解决它。转到@angular/router/router"并在QueryParamsHandling声明之前插入单词'export':

    导出声明类型 QueryParamsHandling = 'merge' | '保留' | '';

    【讨论】:

      猜你喜欢
      • 2021-07-09
      • 1970-01-01
      • 2019-01-17
      • 2022-01-17
      • 2022-08-22
      • 2018-11-25
      • 2018-03-26
      • 2022-01-19
      • 2019-05-10
      相关资源
      最近更新 更多