Search code examples
angularangular-cliangular-material2angular-cli-v6angular-material-6

angular: material update to latest version. Not downloading the specified version


I suppose to install specific version of @angular/material and @angular/cdk in the application. The same is provided in the package.json. But when do npm i it is downloading the latest package of material and cdk.

Screenshot

Steps to reproduce:

  • Clone the repo
  • Install package (npm install)
  • verify downloaded package version (ng -v)

Solution

  • You can update your package.json to use exact version as below :

    "dependencies": {
        "@angular/animations": "6.1.4",
        "@angular/cdk": "6.4.1",
        "@angular/common": "6.1.0",
        "@angular/compiler": "6.1.0",
        "@angular/core": "6.1.0",
        "@angular/forms": "6.1.0",
        "@angular/http": "6.1.0",
        "@angular/material": "6.4.1",
        "@angular/platform-browser": "6.1.0",
        "@angular/platform-browser-dynamic": "6.1.0",
        "@angular/router": "6.1.0",
        "core-js": "2.5.4",
        "rxjs": "6.0.0",
        "zone.js": "0.8.26"
      },
    

    As per npm config You can also set your npm config to use exact version rather than using npm's default semver range operator by running below :

    npm config set save-exact true