Angular 6:错误 TS2315:类型 'ModuleWithProviders' 不是通用的 - 核心和表单版本相同
Angular 6: error TS2315: Type 'ModuleWithProviders' is not generic - core and forms versions is same
我的路由工作不正常,我有两个组件的单独路径,但它们仍然在第二个组件的路径中显示在另一个下方,原因:我的控制台出现以下错误,
尽管尝试了此处给出的解决方案 ,
我仍然遇到同样的错误,现在甚至无法编译。
过去几个小时以来我一直在寻找解决方案,但一直没有成功。
ERROR in node_modules/@angular/platform-browser/src/browser.d.ts(45,9): error TS2315: Type >'ModuleWithProviders' is not generic.
node_modules/@angular/router/src/router_module.d.ts(101,60): error TS2315: Type >'ModuleWithProviders' is not generic.
node_modules/@angular/router/src/router_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,但我担心这可能会导致全新的错误,有人会推荐吗?
我不知道我错过了什么,请帮忙。
感谢您的帮助。
我正在尝试使用一些新库,但我猜不小心与 @angular/core @angular/router @angular/platform-browser
的版本不匹配
我从以上所有三个版本中删除了 ^
符号,以确保它们的版本完全相同,它起作用了。
我的路由工作不正常,我有两个组件的单独路径,但它们仍然在第二个组件的路径中显示在另一个下方,原因:我的控制台出现以下错误,
尽管尝试了此处给出的解决方案
我仍然遇到同样的错误,现在甚至无法编译。 过去几个小时以来我一直在寻找解决方案,但一直没有成功。
ERROR in node_modules/@angular/platform-browser/src/browser.d.ts(45,9): error TS2315: Type >'ModuleWithProviders' is not generic. node_modules/@angular/router/src/router_module.d.ts(101,60): error TS2315: Type >'ModuleWithProviders' is not generic. node_modules/@angular/router/src/router_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,但我担心这可能会导致全新的错误,有人会推荐吗? 我不知道我错过了什么,请帮忙。
感谢您的帮助。
我正在尝试使用一些新库,但我猜不小心与 @angular/core @angular/router @angular/platform-browser
我从以上所有三个版本中删除了 ^
符号,以确保它们的版本完全相同,它起作用了。