本文介绍了package.json中的tilde(〜)和caret(^)有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

升级到最新的稳定版nodenpm后,我尝试了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.

  1. 为什么要在npm中进行这些更改?
  2. 代字号~和插入符号^有什么区别?
  3. 与他人相比有什么优势?
  1. Why are these changes made in npm?
  2. What is the difference between tilde ~ and caret ^?
  3. What is the advantages over others?

推荐答案

请参见 NPM文档模拟器文档

〜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(^)有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 11:59