I have had a problem getting npm to update packages to the latest version. The packages involved are packages that have been installed directly and have no dependencies. It it is down to the use of semantic versioning in npm / node.js but knowing that does not help!
I have a package, canvas-gauges, installed via npm, that I wanted to update. Running
1 |
npm outdated |
told me that;
1 2 |
Package Current Wanted Latest Location canvas-gauges 2.1.3 2.1.3 2.1.4 |
I wanted to update it to the latest version but despite repeated searches, on how to do this, I could not force npm to update the package.
Trying these did not work;
1 2 |
npm update canvas-gauges@latest npm update canvas-gauges@2.1.4 |
I also tried installing and running ncu but that complains there is no package.json file.
There is nothing wrong in what npm is doing, it is following the ‘Wanted’ version even though I wanted the latest evrsion.
Ultimately the solution was simple (just not easily found);
1 |
npm install canvas-gauges@latest |
HTH
by