How does NPM handle version conflicts?

All the dependencies and the internal dependencies tries to get a place in the root of the node_modules unless there is a conflict with the same dependency, but different version. When a conflict raises, it creates a sub node_modules under each dependency needed and pushes conflicting internal libraries in it.

EXAMPLE:
Here, “A” internally depends on “alpha@v1.0” and “B” depends on “alpha@v2.0”.
When you execute install A and B like below:

npm install A
npm install B

node_modules
|_ A
|_ alpha @v1.0
|_ B
|    |_ node_modules
|        |_ alpha @v2.0
|_ ...

NOTE: Another node_modules created under “B” inside the main node_module.

For more details: visit this post.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)