【问题标题】:No compatible version found: @angular/router@^2.0.0-rc.4 error while installing angular2 RC4 router未找到兼容版本:安装 angular2 RC4 路由器时出现@angular/router@^2.0.0-rc.4 错误
【发布时间】:2016-11-03 12:32:48
【问题描述】:

我的 package.json 依赖如下:

"dependencies": {
    "@angular/common": "^2.0.0-rc.4",
    "@angular/compiler": "^2.0.0-rc.4",
    "@angular/core": "^2.0.0-rc.4",
    "@angular/http": "^2.0.0-rc.4",
    "@angular/platform-browser": "^2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "^2.0.0-rc.4",
    "@angular/platform-server": "^2.0.0-rc.4",
    "@angular/router": "^2.0.0-rc.4",
    "angular2-jwt": "0.1.15",
    "es6-promise": "^3.2.1",
    "es6-shim": "^0.35.0",
    "jwt-decode": "^2.0.1",
    "reflect-metadata": "^0.1.2",
    "rxjs": "^5.0.0-beta.6",
    "zone.js": "^0.6.12"
  }

但是当 npm install 出现以下错误:

G:\rc4>npm i
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"                                         npm ERR! node v6.0.0                                                            npm ERR! npm  v3.8.6
npm ERR! No compatible version found: @angular/router@^2.0.0-rc.4
npm ERR! Valid install targets:
npm ERR! 3.0.0-beta.2, 3.0.0-beta.1, 3.0.0-alpha.8, 3.0.0-alpha.7, 3.0.0-alpha.6, 3.0.0-alpha.5, 3.0.0-alpha.4, 3.0.0-alpha.3, 3.0.0-alpha.2, 3.0.0-alpha.1, 3.0.0-alpha.0, 2.0.0-rc.2, 2.0.0-rc.1, 2.0.0-rc.0, 0.2.0, 0.1.0, 0.0.1, 0.0.0-7, 0.0.0-6, 0.0.0-5, 0.0.0-4, 0.0.0-3, 0.0.0-2, 0.0.0-1, 0.0.0-0
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     G:\rc4\npm-debug.log

G:\rc4>

【问题讨论】:

    标签: angular routing npm angular2-routing angular2-router


    【解决方案1】:

    angular-router 的 rc 版本直到 3,例如 "@angular/router": "^2.0.0-rc.3",

    在该版本之后,他们将 angular/router 单独发布为 beta 版本,例如

    "@angular/router":"3.0.0-beta.2"

    【讨论】:

    • 那么在版本中,路由路径是否支持redirectTo?以及如何在 github 上看到带有 rc.5 的标签? github.com/angular/angular/tree/2.0.0-rc.5/modules/%40angular/…
    • 我不明白你的问题到底是什么?
    • 我只是想说,对于路由器,我仍然在 angular github repo 中看到标签,例如 rc.4、rc.5 等,但是当我尝试使用它们时(因为我需要 redirectTo 属性rc.1 不支持女巫)编译器抱怨“不兼容版本”错误。
    【解决方案2】:

    【讨论】:

    • 我有点困惑我已经使用了 router-rc2 但我在提到的链接中看不到这个版本
    猜你喜欢
    • 2013-09-04
    • 1970-01-01
    • 2016-12-20
    • 2019-09-28
    • 1970-01-01
    • 2022-11-18
    • 2018-03-18
    • 1970-01-01
    • 2014-04-11
    相关资源
    最近更新 更多