简体   繁体   English

Npm版本控制-这种边缘情况如何工作?

[英]Npm versioning - how does this edge case work?

Im trying to figure out how npm versioning works because im getting stuck on two invalid packages. 我试图弄清npm版本的工作原理,因为我陷入了两个无效的软件包中。 Ref my other question . 引用我的另一个问题 The module i need, serialport, get these packages invalid, "readable-stream" and "string_decoder". 我需要的模块,串行端口,使这些软件包无效,“可读流”和“ string_decoder”。 Serialport have downloaded this version: Serialport已下载此版本:

readable-stream@1.0.27-1

Serialports dependency is 串行端口依赖性是

"readable-stream": "~1.0.2"

Readable-streams available versions are: 可读流可用版本为:

....
'1.0.26',
'1.0.27-1',
'1.0.31',
....

Which explains why 1.0.27-1 is picked. 这就解释了为什么选择1.0.27-1。 Because of the tilde and ~1.0.2, meaning that these three numbers have to exist in each version. 由于波浪号和〜1.0.2,这意味着在每个版本中必须存在这三个数字。 Ref Jakob Mattsson´s simple article Ref Jakob Mattsson的简单文章

readable-stream downloads 可读流下载

string_decoder@0.10.25-1

readable-stream again depends on 可读流再次取决于

"string_decoder": "~0.10.x"

And string_decoders available versions are 和string_decoders可用的版本是

....
'0.10.24',
'0.10.25-1',
'0.10.25',
'0.10.31',
'0.11.10-1'
....

How come that version is downloaded? 该版本如何下载? Ref the article again , tilde means that it has to has 0.10 in the version number, and x is whatever exists? 再次引用该文章 ,波浪号表示版本号必须为0.10,x是否存在?

Why is not string_decoder@0.10.31 chosen? 为什么不选择string_decoder@0.10.31?

I believe my problem in question is related to prereleases that this extra dash is called. 我相信我的问题, 问题是要prereleases,这个额外的破折号被称为相关。 Im trying to gather facts to maybe seem if dependencies can get updated. 我试图收集事实,似乎可以更新依赖项。

I recieved an answere on github, issue answer , thought i would share it with the rest who might wonder: 我在github上收到了answere, 发出了answer ,以为我会和其他可能会问的人分享:

semver range checking is done semantically, not lexically, so 1.0.31 should match with npm@2: semver范围检查是从语义上而不是从词汇上完成的,因此1.0.31应该与npm @ 2匹配:

% semver -r '~1.0.2' 1.0.26 1.0.27-1 1.0.31 1.0.26 1.0.31 I suspect that the behavior you're seeing is due to a bundledDependency included in the package tarball. %semver -r'〜1.0.2'1.0.26 1.0.27-1 1.0.31 1.0.26 1.0.31我怀疑您看到的行为是由于软件包tarball中包含的bundledDependency引起的。

See Node app fails to run because of prerelease for a more detailed answer too why this happens. 有关更详细的答案,请参见节点应用程序由于预发布无法运行,以及发生这种情况的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM