Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM caret doesn't bring in newest minor version

Tags:

javascript

npm

In my package.json one of my dependencies is... "@packageXXX": "^0.7.0",

When I do a "npm outdated" I see... @packageXXX current: 0.7.0 wanted: 0.7.0 latest: 0.8.0

When I do "npm i" it doesn't install the latest minor version "0.8.0"

My understand is having the caret there is suppose to update to the latest minor version, but it doesn't. Can someone explain what I'm doing wrong?

like image 529
Carson the Powers Avatar asked Apr 03 '18 18:04

Carson the Powers


People also ask

What is the purpose of the caret prefix used in the updated version?

Caret (^) notation: It is used for automatically updating the minor updates along with patch updates. Example: The ^1.2. 4 will update all the future Minor and patch updates, for example, ^1.2. 4 will automatically change the dependency to 1.

What does the caret mean in npm version?

Using a caret (^) sign means that we can accept minor releases and patch releases, but not a major release when updating our package.

How do I update my childs npm?

Delete node_modules folder and package.lock. json files. You then run npm install and the packages should be updated. Worked for me anyway.


1 Answers

This is the case with 0.x.x since a leading zero indicates that the package isn't into a "stable" version yet. Until your package hits 1.x.x you'll need to do these updates manually (and be careful...your package isn't stable yet, meaning breaking changes can occur!).

https://semver.org/

Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.

like image 200
KayakinKoder Avatar answered Oct 09 '22 07:10

KayakinKoder