Angular 2 rc3 router-deprecated package issue

断了今生、忘了曾经 提交于 2019-12-01 16:40:16

问题


Welcome Angular 2 rc.3!

I use project.json from 5 Min Quickstart to configure my project, but when i run npm install i get follow error:

No compatible version found: @angular/router-deprecated@2.0.0-rc.3
Valid install targets:
2.0.0-rc.2, 2.0.0-rc.1, 2.0.0-rc.0, 0.0.0-7, 0.0.0-6

Does anyone know what reason of that? Maybe quickstart doc out-of-date?


回答1:


I think so its by mistake

try the last version of release

  "@angular/router-deprecated":  "2.0.0-rc.2",



回答2:


Angular2 RC3 brings back the new router. But the Tutorial continues to mention router-deprecated. Check out the Developer guide which has documentation on the latest Router: https://angular.io/docs/ts/latest/guide/router.html

As mentioned in the comments, you can give it a try using

"@angular/router": "3.0.0-alpha.7"



回答3:


i'm running rc.2, but with the new component router. https://angular.io/docs/ts/latest/guide/router.html. here's the package.json

"dependencies": {
"@angular/common":  "^2.0.0-rc.2",
"@angular/compiler":  "2.0.0-rc.2",
"@angular/core":  "2.0.0-rc.2",
"@angular/http":  "2.0.0-rc.2",
"@angular/platform-browser":  "2.0.0-rc.2",
"@angular/platform-browser-dynamic":  "2.0.0-rc.2",
"@angular/router":  "3.0.0-alpha.6",
"@angular/upgrade":  "2.0.0-rc.2",
"systemjs": "0.19.31",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.12",
"bootstrap": "^3.3.6",
"contentful": "3.3.14"

}

i'm using the alpha6, cause i didn't got alpha7 working. anyhow, if you starting new in a project, i would go for the new component router. the developer even recommend it: http://angularjs.blogspot.ch/2016/06/improvements-coming-for-routing-in.html




回答4:


You guessed right, the QuickStart tutorial doc was in fact wrong, and the Pull Request handling this has just recently merged its commits. Should you go to the QuickStart docs again, you'll see it's been updated!

Here's the closed Pull Request: https://github.com/angular/angular.io/pull/1727

So no worries, you were doing just fine!



来源:https://stackoverflow.com/questions/37959130/angular-2-rc3-router-deprecated-package-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!