Re: Installing modules in a flat directory

591 views
Skip to first unread message

greelgorke

unread,
Oct 18, 2012, 3:49:56 AM10/18/12
to nod...@googlegroups.com
you should better ask here https://groups.google.com/forum/?fromgroups=#!forum/npm-


Am Mittwoch, 17. Oktober 2012 20:07:54 UTC+2 schrieb Justin Beckwith:
Greetings folks,
I'm trying to use a module on Windows that has many dependencies.  Many of these dependencies have dependencies and the depth of node_modules increases pretty quick.  Generally this isn't a problem, unless you're using Windows :)  Windows (or specifically some of the software we're building on Windows with .NET) doesn't really like file paths longer than 260 characters.  Is there a way to build a module where the deep level dependencies are all stored at the root of it's node_modules directory?  Or am I stuck using the hierarchical model?

Thanks!

Bradley Meck

unread,
Oct 18, 2012, 10:06:56 AM10/18/12
to nod...@googlegroups.com
1. npm dedup can help.
2. if that is not enough: all modules can reference parent module's node_modules, so if you recursively move all dirs into the root node_modules it should work.

a/node_modules/b/node_modules/c -> a/node_modules/c

Isaac Schlueter

unread,
Oct 20, 2012, 8:56:47 AM10/20/12
to nod...@googlegroups.com
This is not a bug in node or npm, and not something that can be
realistically fixed in npm, without changing it in a very fundamental
way.

I'm all too familiar with the annoying error you're encountering. The
"specific software you're using that is built on .NET" should do the
same thing that Node does, and use the UNC equivalents for long path
names.

Or, you can maintain your node_modules folders manually. It's not
really *that* hard. The pattern is pretty simple.
http://api.nodejs.org/modules.html
> --
> 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

Bert Belder

unread,
Oct 20, 2012, 11:38:12 AM10/20/12
to nod...@googlegroups.com, i...@izs.me
Isaac, could 'npm flatten' help here?

Isaac Schlueter

unread,
Oct 23, 2012, 4:05:37 PM10/23/12
to Bert Belder, nod...@googlegroups.com
Bert,

It's called "npm dedupe".  Yes, it can help, but usually not enough.  If you have version conflicts, then it'll still end up nesting, by design.

Chris Nienhuis

unread,
May 4, 2014, 3:23:47 PM5/4/14
to nod...@googlegroups.com, Bert Belder, i...@izs.me
I know this is a old thread, but I recently wrote a node module that can flatten you dependencies here: https://www.npmjs.org/package/npm-flatten.  Check it out.
Reply all
Reply to author
Forward
0 new messages