bash npm 过时的输出颜色编码含义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31559390/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
npm outdated output colour-coding meaning
提问by U r s u s
I run git command npm outdated
in bash on a mac.
我npm outdated
在 Mac 上的 bash 中运行 git 命令。
See the output in the image below.
请参阅下图中的输出。
Does anyone know why the first four packages are printed in red?
有谁知道为什么前四个包装是红色的?
I guess it's because I have them pointing to github repos in my package.json, but why the red?
我想这是因为我让他们在我的 package.json 中指向 github repos,但为什么是红色的?
Is it a warning? Should I worry?
是警告吗?我应该担心吗?
Thank you.
谢谢你。
采纳答案by robertklep
You have to be careful when depending on packages that are Github-hosted: if you're just pointing to the master
branch of a package (which is the default when adding such dependencies), you can get in all sorts of trouble when that branch is updated and it's either not functional (it happens) or it breaks backward compatibility (that happens too).
在依赖 Github 托管的包时必须小心:如果您只是指向master
包的分支(这是添加此类依赖项时的默认值),那么当该分支是时,您可能会遇到各种麻烦更新,它要么不起作用(它发生了),要么破坏了向后兼容性(也发生了)。
I think this is what npm
is trying to tell you.
我想这就是npm
试图告诉你的。
FWIW, you should always include an identifier to a particular commit/tag/sha when you're dealing with Github-hosted dependencies. See thisfor more documentation. Although I doubt that npm
won't also mark these URL's as red, because it's still possible for any of those identifiers to get invalidated.
FWIW,当您处理 Github 托管的依赖项时,您应该始终包含特定提交/标签/sha 的标识符。见这为更多的文档。尽管我怀疑这npm
不会也将这些 URL 标记为红色,因为这些标识符中的任何一个仍有可能失效。
EDIT: perhaps not quite.
编辑:也许不完全。
Looking at it a little closer, it'll show the package name in red if the installed version doesn't (semver-)match the required version as set in package.json
. In case of Github-hosted packages these will probably nevermatch, hence the red.
再仔细看一下,如果安装的版本与package.json
. 对于 Github 托管的软件包,这些可能永远不会匹配,因此是红色的。
Yellow is used when the installed version matches the required version, but there's a more recent version available in the NPM repository.
当安装的版本与所需版本匹配时使用黄色,但 NPM 存储库中有更新的版本可用。
回答by Nowy
Due to SemVer ^x.y.z caret format, red colors clearly indicate that packages are out of date, and they need to be upgraded. And yellow ones indicate that packages are out of date as well, but to upgrade, there might be breaking changes....
All packages in red should be upgraded first, then upgrade ones in yellow, because of the possibility of breaking change.
由于 SemVer ^xyz 插入符号格式,红色明确表示软件包已过期,需要升级。黄色的表示软件包也已过时,但要升级,可能会有重大更改....
所有红色的包都应该先升级,然后再升级黄色的,因为有可能破坏更改。
https://realguess.net/2014/12/13/update-outdated-npm-packages/
https://realguess.net/2014/12/13/update-outdated-npm-packages/
回答by Mulli
Update - as of 2/27/2019 I had the same problem, moved to yarn and got the following:
更新 - 截至 2019 年 2 月 27 日,我遇到了同样的问题,转向纱线并得到以下信息:
> yarn outdated
yarn outdated v1.13.0
info Color legend :
"<red>" : Major Update backward-incompatible updates
"<yellow>" : Minor Update backward-compatible features
"<green>" : Patch Update backward-compatible bug fixes
...
Please read the small letters... red is backward-incompatibleNpm follows the same color semantics.
请阅读小写字母...红色是向后不兼容的Npm 遵循相同的颜色语义。
Unlike the answers above, all outdated packages can be updated. This is a project specific upgrade policy decision.
与上面的答案不同,所有过时的软件包都可以更新。这是一个项目特定的升级政策决定。
Hope that helps
希望有帮助