I am somewhat new to npm and I have been working on converting an existing build process to use grunt with npm package management. We have a number of internal components that we build our apps upon. This results in a dependency tree that can get fairly complex. As a simplified example, consider:
[email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
└── [email protected]
In the maven world the module-translation package would be resolved to a single version and the build system then knows which package to include into the app.
In npm, I'm finding that the full tree is created in the node_modules directory, following the method described here, under the section: Cycles, Conflicts, and Folder Parsimony.
There is a related question asked here, but with no answer: npm nested dependency management.
If you want to uninstall all global packages, then you need to name the packages one by one in the npm uninstall -g command. Run the npm list -g --depth=0 command to list the packages installed globally on your computer. That should uninstall all global packages for you.
I'm finding that this question doesn't quite make sense in the world of npm dependency management. Unlike tools such as maven, js can have multiple versions of the same package/artifact used at the same time.
My understanding is that using a tool such as browserify (or requirejs) it can handle the above situation where different versions of "module-translation" are needed. So really, there is no need to flatten the tree. Since flattening the tree could produce versioning conflicts, why do it if browserify can handle the multiple versions anyway?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With