git dependency of dependeny not installed in deep node_modules

38 views
Skip to first unread message

Maxim Yefremov

unread,
Jul 11, 2013, 10:53:10 PM7/11/13
to nod...@googlegroups.com
I got module A that depending on module B by git dependency and module B depending on module C. At the same time module A depends on module C by git dependency. When I do npm install for A it install B and C in node_modules but in A/node_modules/B/node_modules I do not see C folder as expected. If I remove dependency C from A it install B with dependency C well. But I want A to depend on C too.

Marco Rogers

unread,
Jul 12, 2013, 12:13:23 AM7/12/13
to nod...@googlegroups.com
Assuming the C dependency is the same or compatible version between A and B, then this is working as expected. npm knows how to resolve recursive dependencies such that they are not duplicated. If A and B depended on different versions of C, then you would be both of those as you originally expected.

See the npm docs for the install algorithm.

https://npmjs.org/doc/install.html

:Marco

greelgorke

unread,
Jul 12, 2013, 3:49:45 AM7/12/13
to nod...@googlegroups.com
the way how node module loader resolves modules allows it to place C only once in the hierarchy of dependencies. B still has access to C. http://nodejs.org/api/modules.html#modules_all_together describes, how the resolver works.

Maxim Yefremov

unread,
Jul 12, 2013, 7:37:48 AM7/12/13
to nod...@googlegroups.com
Thanx Marco and greelgorke. Looks like true. But the problem is that module B dont have access to C and throws error (module not found) if it is loaded in A/node_modules and not in A/node_modules/B/node_modules. Allthough it's required as usual inside B: require('C'). I found temporal solution: comment C dependency  in A, then npm intall in A and then uncomment it and npm install again. C version is the same in A and B.


--
--
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
 
---
You received this message because you are subscribed to a topic in the Google Groups "nodejs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nodejs/xgnN1z0cYjo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
С уважением,
Максим Ефремов

Reply all
Reply to author
Forward
0 new messages