NPM package update [ETARGET] error

Just a quick one.

When updating a particular package from NPM that has just been released recently, there is a possibility that it won't be picked up by NPM update.

In this case I was trying to update the generator-jhipster package to its latest version of 7.6.0.

The documentation recommended doing a standard npm update command:

npm update -g generator-jhipster

However after updating it still showed the previous version of 7.5.0.

Trying to get NPM to install a specific version caused an ETARGET error.

npm install generator-jhipster@7.6.0

npm ERR! code ETARGET
npm ERR! notarget No matching version found for generator-jhipster@7.6.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

When inspecting the package using npm view it showed the latest distributable as being 7.5.0

dist-tags:
beta: 7.0.0-beta.1 latest: 7.5.0

This is because NPM hits the local cache first rather than making a request to the NPM registry.

By running the following command:

npm cache clean --force

Then verifying with:

npm view generator-jhipster

It will show the latest version of the package that has been published and you can then run the update command successfully on the particular package.