├─┬ js...@0.2.10
│ ├── conte...@0.0.7
│ ├── cs...@0.2.1
│ ├── htmlp...@1.7.3
│ └── req...@2.2.9
└── req...@2.2.9
Should I delete the `request` package inside the `jsdom`
node_modules/, so there is only one copy of the module, or it's better
just to leave it as it is?
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
I'm not sure but I think npm checks if the same dependency with the
same version already exists in a parent directory, it won't install it
again.
On Dec 19, 12:20 pm, Mark Hahn <m...@hahnca.com> wrote:
> Since there is no harm I would leave it alone. I wouldn't want to take
> over responsibility for package management when npm already does a good job.
>
>
>
>
>
>
>
> On Sat, Dec 17, 2011 at 4:51 PM, realguess <realgu...@gmail.com> wrote:
> > For example, in a node_modules/:
>
> > ├─┬ js...@0.2.10
> > │ ├── context...@0.0.7
> > │ ├── cs...@0.2.1
> > │ ├── htmlpar...@1.7.3
> > │ └── requ...@2.2.9
> > └── requ...@2.2.9
They may look like duplicates, but it's not clear you want to prune
them. In the tree in the original post, there are two copies of
'request', but they're there for a reason. One is there because jsdom
has a declared dependency on request. The other is there presumably
because the parent package declared its own dependency on request.
What's there now is two copies of the same version, but there's
nothing to say that that would always be the case; it depends on how
the version constraints are specified. It's entirely possible, for
example, for jsdom to require a different version from the top level
package. The tree structure within node_modules is specifically
designed to allow for that.
--
Martin Cooper
> I was hoping that maybe npm prune would do something like this where if you
> ran it from the top level it could indentify duplicates and remove them, but
> it only removes extraneous packages.
>
> Maybe a new --option for prune?
>
> Or is there a better way?
>
> Thanks in advance.
>
> Jeff
>
You may also need to modify the way Node finds a module's dependencies
to load. Or perhaps only remove duplicates when it's clear that the
loader will find another copy in the module load path? You'd also need
to modify npm to check all of the dependencies in an application's
tree when one module is updated, to ensure that prior removals would
still be valid with respect to version constraints, and potentially
then reinstate them if they're not. That sounds a bit messy to me.
Perhaps not impossible, but I'm not sure I see the advantage to
pruning duplicates. Most Node packages are very small, so there's no
real cost to having each module own its own dependencies, and it does
simplify things.
To each his own, though. I'll be interested in looking at such a tool,
should you choose to build one.
--
Martin Cooper
>Now one can go into your root package.json and add all of the duplicated dependencies from every package below
... don't do this.
On Sat, Dec 24, 2011 at 1:36 PM, Mark Hahn <ma...@hahnca.com> wrote:
>
> > If these are required in many modules and they are not pulled in at the top then you can start to see how it could become more significant.
>
> No I don't see that. I wouldn't mind if modules were 100M. You can fit 10,000 such modules in terabyte.
>
>
How about leaving deduplication to a filesystem or so?
Right.
> So not only will do you have duplicate space on the file system and possibly
> duplicate build time (for compiled modules), you also have different copies
> of modules loaded into memory (even if they are the same version) (and any
> data they cache).
People might be using that to be able to monkeypatch their own copy of a module.