npm 包列表中删除了哪些内容? [英] What is deduped in npm packages list?

查看:82
本文介绍了npm 包列表中删除了哪些内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将命令作为 npm list 运行,我得到下面提到的列表作为我的依赖项,我想知道 deduped 的含义是什么.请告诉我这是什么意思.

I am running command as npm list and I get below mentioned list as my dependencies and I want to know what is the meaning of deduped. Please let me know the meaning of this.

推荐答案

deduped 是deduplicated"的缩写(删除重复项).npm dedupe 的文档解释了 npm 这样做:

deduped is short for "deduplicated" (duplicates were removed). The documentation for npm dedupe explains how npm does this:

搜索本地包树并尝试通过将依赖项进一步向上移动来简化整体结构,以便多个依赖包更有效地共享它们.

Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree, where they can be more effectively shared by multiple dependent packages.

换句话说,它会查看多个包是否具有相同的依赖项(意味着相同的包版本范围)并将它们指向"同一个包.

In other words, it looks if multiple packages have the same dependencies (meaning the same packages and version range) and "points" them to the same package.

引用相同的包,因此不必安装两次.

The same package is referenced, so it doesn't have to be installed twice.

此外,它将包向上"移动(使树变平).这是完全合理的,否则一个包将不得不查看其他包的 node_modules(这会有点混乱)并有助于简化依赖关系.

Also, it moves the packages "up the tree" (flattens the tree). This makes total sense as otherwise one package would have to look in the node_modules of some other package (which would be kind of messy) and helps to simplify the dependencies.

您可以验证这一点,因为您的依赖关系图中显示 deduped 的每个包都可以在图中至少再找到一次,通常是在更高的级别.

You can validate this, as every package in your dependency graph that says deduped, can be found at least one more time in the graph, usually at a higher level.

在您发布的屏幕截图中,content-type@1.0.4body-parser 的依赖项.再往下一点,它也被列为更高一级的 express 的直接依赖项.

In the screenshot you posted content-type@1.0.4 is a dependency of body-parser. A bit further down, it's also listed as a direct dependency of express one level higher.

这篇关于npm 包列表中删除了哪些内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆