Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependencies versions conflicts on node.js

I'm new to the node.js world and I was asking how I could handle dependencies versions conflics (which often appears with transitive dependencies): on the internet found only this article useful for me http://nodejs.org/api/modules.html#modules_addenda_package_manager_tips.

So it seems that i don't have to worry about conflicts because of how the packages are managed in node.js. Am I wrong, am I missing something? This seems strange (but still makes sense) to me, I'm used to handle dependencies with maven, setting the transitive dependencies that don't have to be downloaded.

Any help is appreciated, thank you.

like image 240
reallynice Avatar asked May 27 '13 14:05

reallynice


1 Answers

npm and the node require system will take care of this for you automatically. For example, your program can depend on dep1 and dep2. dep1 can require subdep version 1.0 and dep2 can require subdep version 2.0, and npm will install multiple versions so each module gets the dependency versions it needs.

your-module/
    node_modules/
        dep1/
            node_modules/
                subdep/ (1.0)
        dep2/
            node_modules/
                sudbep/ (2.0)
like image 139
Peter Lyons Avatar answered Sep 22 '22 14:09

Peter Lyons