Angular 6: 错误 TS2315: 'ModuleWithProviders'类型不是通用的 - 核心和表单版本是一样的。

问题描述 投票:0回答:1

我的路由无法正常工作,我有两个组件的独立路径,但它们仍然在第二个组件的路径中显示一个低于另一个,原因是:在我的控制台中出现以下错误,尽管尝试了这里给出的解决方案。ANGULAR 6: 错误 TS2315: 'ModuleWithProviders'类型不是通用的。,

我仍然收到同样的错误,现在甚至无法编译。我从过去的几个小时开始搜索解决方案,但没有找到。

ERROR in node_modules@angularplatform-browsersrcbrowser.d.ts(45,9): error TS2315: node_modules@angularroutersrcrouter_module.d.ts(101,60): error TS2315: Type >'ModuleWithProviders' is not generic.错误。node_modules@angularroutersrcrouter_module.d.ts(105,38): error TS2315: Type >'ModuleWithProviders'is not generic. node_modules@angularroutersrcrouter_module.d.ts(105,38): error TS2315: Type >'ModuleWithProviders' is not generic.

下面是我的package.json。

{
  "name": "cakewale",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/cdk": "^6.0.0",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "6.0.3",
    "@angular/forms": "6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "animate.css": "^3.7.2",
    "core-js": "^2.5.4",
    "rxjs": "6.0.0",
    "wowjs": "^1.1.3",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.8",
    "@angular/cli": "~6.0.8",
    "@angular/compiler-cli": "^6.0.3",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "shallow-render": "^7.2.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

我想把版本改成6.1.2,但我怕会导致完全新的错误,有谁推荐吗?我搞不清楚我缺什么,请大家帮忙。

谢谢大家的帮助。

angular6 package.json
1个回答
0
投票

我试图使用一些新的库,并猜测不小心错配了版本的 @angular/core @angular/router @angular/platform-browser

我去掉了 ^ 以上三个版本的标志,以确保他们的版本是完全相同的,它的工作。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.