Home > front end >  Angular - Wrong package versions?
Angular - Wrong package versions?

Time:11-09

I've an angular app. In the package.json I defined for all angular packages the version 12.2.9 like:

"@angular/animations": "^12.2.9",
"@angular/cdk": "^12.2.9",
"@angular/common": "^12.2.9",
"@angular/compiler": "^12.2.9",
"@angular/core": "^12.2.9",
...

I deleted the node_modules folder and the 'package-lock.json`

The I installed all packages with npm install

After that, calling npm outdated, the current version for all my angular packages is 12.2.13 and not 12.2.9

Where is defined, that the 12.2.13 version is installed and not the version from the package.json?

CodePudding user response:

In package-lock.json there is all information about your installed packages in node_modules. if you go there and search the file for @angular/animations for instance you will see your version.

Solution is to delete node_modules and package-lock.json and clear cache by running npm cache clean --force.

UPDATE:


As Harun Yilmaz mentioned in comments:

There are carets (^) in the versions. So, deleting package-lock.json and node_modules and running npm install will still install the latest compatible version.

You can find out what exactly ^ and ~ do in npm package managing in this answer by jgillich.

  • Related