How to get list of versions for compatible Angular

2019-06-23 15:41发布

问题:

I have the following code in the package.json:

 "dependencies": {
    "@angular/common": "~2.0.1",
    "@angular/compiler": "~2.0.1",
    "@angular/core": "~2.0.1",
    "@angular/forms": "~2.0.1",
    "@angular/http": "~2.0.1",
    "@angular/platform-browser": "~2.0.1",
    "@angular/platform-browser-dynamic": "~2.0.1",
    "@angular/router": "~3.0.1",
    "@angular/upgrade": "~2.0.1",
    "angular-in-memory-web-api": "~0.1.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.8",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.39",
    "zone.js": "^0.6.25"
  },

I got this file from one tutorial. Now I see that I need to move to the later Angular 2 version. It is said on Angular 2 project page that 2.4.0 is the latest Angular 2 version. That is fine - but how can I get the versions for all the necessary modules that are compatible by 2.4.0? E.g. I have 3.0.1 for router and 2.0.1 for the common. What the new version numbers should be?

回答1:

All angular modules except router have the same version number, router usually has the same minor and patch version, i.e. angular 2.0.1 => router 3.0.1.

In general, you can find corresponding versions in node_modules/@angular/[core|router|...]/package.json

@angular/core 2.4.1:

"peerDependencies": { "rxjs": "^5.0.1", "zone.js": "^0.7.2" }

@angular/router 3.4.1:

"peerDependencies": { "@angular/core": "2.4.1", "@angular/common": "2.4.1", "@angular/platform-browser": "2.4.1", "rxjs": "^5.0.1" }