Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
345 views
in Technique[技术] by (71.8m points)

node.js - package.json中的tilde(?)和caret(^)有什么区别?(What's the difference between tilde(~) and caret(^) in package.json?)

After I upgraded to latest stable node and npm , I tried npm install moment --save .

(升级到最新的稳定nodenpm ,我尝试了npm install moment --save 。)

It saves the entry in the package.json with the caret ^ prefix.

(它将条目以尖号^保存在package.json 。)

Previously, it was a tilde ~ prefix.

(以前,它是一个波浪号~前缀。)

  1. Why are these changes made in npm ?

    (为什么在npm进行这些更改?)

  2. What is the difference between tilde ~ and caret ^ ?

    (是什么波浪之间的区别~和尖^ ?)

  3. What is the advantages over others?

    (与其他相比有什么优势?)

  ask by Fizer Khan translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

See the NPM docs

(查看NPM文档)

~version “Approximately equivalent to version”, will update you to the next patch version.

(?version“大约等同于版本”将把您更新到下一个补丁程序版本。)

See semver .

(参见semver 。)

~1.2.3 will use releases from 1.2.3 to <1.3.0.

(?1.2.3将使用从1.2.3到<1.3.0的发行版。)

^version Will update you to the next minor version.

(^ version将您更新到下一个次要版本。)

See semver .

(参见semver 。)

^2.3.4 will use releases up to 3.0.0.

(^2.3.4将使用3.0.0以下的发行版。)

See Comments below.

(请参阅下面的评论。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...