What is the best way to update angular material in a project to latest version material@2.0.0-alpha.8-3
?
I tried:
npm install --save @angular/material @angular/cdk
What is the best way to update angular material in a project to latest version material@2.0.0-alpha.8-3
?
I tried:
npm install --save @angular/material @angular/cdk
You'll want to use the npm update command. An example would look like this.
npm update @angular/material @angular/cdk
This will install the latest stable version. If you would like to target a specific version, you would have to specify it by adding the version to the end after an @ symbol.
Additionally, you can check for outdated packages with
npm outdated
Here's the documentation on npm update.
https://docs.npmjs.com/cli/update
Use the following command:
ng update @angular/material
Note: I recently used this command to upgrade from version 8 to version 9. I have not tested it for older versions.
The following step helped me to update material theme from v9 to v10.
First removed the old package
npm remove @angular/material @angular/cdk
Then installed the latest package
npm add @angular/material @angular/cdk
Way 1
Have you try with a simple npm i @angular/material
? As reported at npmjs he will fetch the latest version.
Way 2
delete the file package-lock.json
and in your package.json
check that you are up to date with the latest angular material, after that simply do an npm i
first remove from `package-lock.json` this
// "@angular/material": {
// "version": "6.4.7",
// "resolved": "https://registry.npmjs.org/@angular/material/-/material-6.4.7.tgz",
// "integrity": "sha512-SdNx7Xovi24Kw9eU6lkLhY/7f2M7L9F+/uh6XuPr4jbGgCUVVpeeVI5ztZhsZRbj1sN+/r1p5w8u62apWWl5Ww==",
// "requires": {
// "parse5": "^5.0.0",
// "tslib": "^1.7.1"
// },
// "dependencies": {
// "parse5": {
// "version": "5.1.0",
// "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz",
// "integrity": "sha512-
fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==",
// "optional": true
// }
// }
// },
// "@angular/cdk": {
// "version": "7.3.7",
// "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-7.3.7.tgz",
// "integrity": "sha512-xbXxhHHKGkVuW6K7pzPmvpJXIwpl0ykBnvA2g+/7Sgy5Pd35wCC+UtHD9RYczDM/mkygNxMQtagyCErwFnDtQA==",
// "requires": {
// "parse5": "^5.0.0",
// "tslib": "^1.7.1"
// },
// "dependencies": {
// "parse5": {
// "version": "5.1.0",
// "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz",
// "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==",
// "optional": true
// }
// }
// },
second remove from `package.json` this line
// "@angular/material": "^6.4.7",
// "@angular/cdk": "^7.3.7",
then finaly run this
npm install --save @angular/material @angular/cdk