What is deduped in npm packages list?

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.

Please check below mention image...!!!!

1

2 Answers

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.

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.

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.

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.

0

Sadly i can only post it here and not in the comment section, since i don't have 50 rep, but with npm v8.3 you can also use overrides for packages in your tree:

Why do i mention it?

-> overrides are also tagged with "deduped" no mater how high they are on tree, so even if package x in branch y is only listened once it still will be marked "deduped"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like