简体   繁体   English

这个 npm semver 有什么问题?

[英]What is wrong with this npm semver?

I want do add following dependency to package.json of my npm package:我想在我的 npm 包的 package.json 中添加以下依赖项:

"redux-saga": "^1.0.0-beta.0 || ^0.16.0"`.

So when I install this package of mine inside different project that already has所以当我在已经有的不同项目中安装我的这个包时

"redux-saga": "^1.0.0-beta.1

I expect npm/yarn to install only 1.0.0-beta.1 inside project's node_modules .我希望 npm/yarn 在项目的node_modules只安装1.0.0-beta.1 node_modules However, it installs 0.16.0 transitively inside my package.但是,它会在我的包中传递地安装0.16.0

So I checked with semver calculator and got weird results for redux-saga package:所以我检查了semver 计算器并得到了redux-saga包的奇怪结果:

  • ^1.0.0-beta.0 || ^0.16.0 ^1.0.0-beta.0 || ^0.16.0 only allows 0.16.0 - this is unexpected ^1.0.0-beta.0 || ^0.16.0只允许0.16.0 - 这是意外
  • ^1.0.0-beta.0 || ^0.15.0 ^1.0.0-beta.0 || ^0.15.0 allows expected ^1.0.0-beta.0 || ^0.15.0允许预期

    0.15.0 0.15.1 0.15.2 0.15.3 0.15.4 0.15.5 0.15.6 1.0.0-beta.0 1.0.0-beta.1

I could not find any explanation in docs.我在文档中找不到任何解释。 My question is - if it's not a bug, then why ^1.0.0-beta.0 || ^0.16.0我的问题是 - 如果它不是错误,那么为什么^1.0.0-beta.0 || ^0.16.0 ^1.0.0-beta.0 || ^0.16.0 does not allow 1.0.0-beta.1 ? ^1.0.0-beta.0 || ^0.16.0不允许1.0.0-beta.1吗?

My question has been answered on npm community forums .我的问题已在 npm 社区论坛上得到解答。

0.16.0 gets installed because it is tagged latest , and npm prioritizes latest tag. 0.16.0被安装,因为它被标记为latest ,并且 npm 优先考虑latest标记。 The algorithm can be found in npm-pick-manifest package.该算法可以在npm-pick-manifest包中找到。

I ended up usingyarn resolutions to solve versions conflict我最终使用纱线分辨率来解决版本冲突

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

相关问题 npm 错误。 semver.simplifyRange 不是 function - npm ERR! semver.simplifyRange is not a function Npm 安装找不到模块“semver” - Npm install cannot find module 'semver' Semver太难了还是怎么回事? - Semver is too difficult or what’s going on? 如何在 Windows 10 中修复 npm 命令。(找不到模块)(Semver) - How to fix npm command in windows 10. (MODULE NOT FOUND) (Semver) 我的npm打包的vue组件导出有什么问题? - What is wrong with the export of my npm packaged vue component? 什么是HTML文件中的“需要数据”“数据保存器”? - What are “data-require” “data-semver” in HTML files? 将 d.ts 文件添加到 JavaScript npm 包是否是 SemVer 规则的重大更改? - Is adding a d.ts file to a JavaScript npm package a breaking change by SemVer rules? 由于错误:找不到模块“semver”,在 ubuntu 上看不到 npm 版本 - Cant see npm version on ubuntu because of Error: Cannot find module 'semver' 文件类型的npm模块尽管被缓冲区调用仍返回null,我在做什么错呢? - file-type npm module returns null despite being called with buffer, what am I doing wrong? 无法安装和使用特定的npm软件包。 我究竟做错了什么? - Trouble installing & using a particular npm package. What am I doing wrong?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM