Set top level dependency version in npm v3Ask Question


npm v3 uses flat structure of dependencies. So I have some modules that use different versions of the same dependence. Is it any way to set, which version of this dependence would be in the root of node_modules?


You can use npm shrinkrwap to override nested dependency versions, forcing all dependencies to use the same version.

From the docs:

This command locks down the versions of a package's dependencies so that you can control exactly which versions of each dependency will be used when your package is installed.

Unfortunately there has been a long running issue with npm v3 and shrinkwrap. The ticket is still open, but the discussion does appear to include a branch that supposedly fixes the issue.

标签: npm
© 2014 TuiCode, Inc.