What's the difference between tilde(~
) and caret(^
) in package.json? Back
Sometimes, we will construct our package.json
to set up dependencies which will be used in projects, but when specifying versions, we should always see two notation: tilde (~
), and caret (^
). So, what is the difference between them?
tilde (
~
):this notation matches the most recent minor version. For example,
~1.2.3
matches all1.2.x
versions, but not1.3.0
.caret (
^
):this notation matches the most recent major version. For instance,
^1.2.3
matches all1.x.x
versions, but not2.0.0
.
As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.
Notice: This plugin has used Cookie to store your token with an expiration.