path / node_modules / @ angular / router / router“'没有导出的成员'QueryParamsHandling'

时间:2019-11-16 12:09:54

标签: angular

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

错误

  

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'。

3 个答案:

答案 0 :(得分:1)

我也面临同样的问题,这对我有用。 使用此版本的coreui-“ @ coreui / angular”:“ 2.5.3”

根据该版本的代码,该版本中未引用QueryParamsHandling。

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

答案 1 :(得分:0)

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

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

将解决此问题。

答案 2 :(得分:0)

我设法解决了这个问题。转到@ angular / router / router”,并在QueryParamsHandling声明之前插入单词“ export”:

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