问题描述
升级到最新的稳定版node
和npm
后,我尝试了npm install moment --save
.它将条目保存在package.json
中,并带有脱字符号^
前缀.以前,它是波浪号~
前缀.
After I upgraded to latest stable node
and npm
, I tried npm install moment --save
. It saves the entry in the package.json
with the caret ^
prefix. Previously, it was a tilde ~
prefix.
- 为什么要在
npm
中进行这些更改? - 代字号
~
和插入符号^
有什么区别? - 与他人相比有什么优势?
- Why are these changes made in
npm
? - What is the difference between tilde
~
and caret^
? - What is the advantages over others?
推荐答案
〜version大约等同于版本"将把您更新到所有将来的补丁程序版本,而不会增加次要版本. ~1.2.3
将使用从1.2.3到< 1.3.0的发行版.
~version "Approximately equivalent to version", will update you to all future patch versions, without incrementing the minor version. ~1.2.3
will use releases from 1.2.3 to <1.3.0.
^ version与版本兼容",将使您更新到所有将来的次要/修补程序版本,而无需增加主要版本. ^2.3.4
将使用从2.3.4到< 3.0.0的发行版.
^version "Compatible with version", will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4
will use releases from 2.3.4 to <3.0.0.
请参阅下面的评论.
这篇关于package.json中的tilde(〜)和caret(^)有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!