For example, given two node modules, a and b.
a/package.json
{
"name": "a",
"version": "1.0.0",
"dependencies": {
"fastify": "3.24.0"
}
}
b/package.json
{
"name": "b",
"version": "1.0.0",
"dependencies": {
"a": "*",
"fastify": "^3.24.0"
}
}
After running npm install in b, there are two versions of fastify in b's node_modules. One is node_modules/fastify (3.25.0), the other is node_modules/a/node_modules/fastify (3.24.0), which makes the instances created by fastify in the two modules (a and b) respectively belong to different classes and causes problems.
It's weird that npm doesn't just choose to use one version (such as 3.24.0) of the same package that fits all semver conditions.