diff --git a/lib/install/deps.js b/lib/install/deps.js index 4d315ab1880a9..d7afa435fb95c 100644 --- a/lib/install/deps.js +++ b/lib/install/deps.js @@ -414,7 +414,7 @@ exports.loadDevDeps = function (tree, log, next) { }, andForEachChild(loadDeps, andFinishTracker(log, next))) } -exports.loadExtraneous = function loadExtraneous (tree, log, next) { +var loadExtraneous = exports.loadExtraneous = function (tree, log, next) { var seen = {} function loadExtraneous (tree, log, next) { validate('OOF', arguments) @@ -429,6 +429,9 @@ exports.loadExtraneous = function loadExtraneous (tree, log, next) { exports.loadExtraneous.andResolveDeps = function (tree, log, next) { validate('OOF', arguments) + // For canonicalized trees (eg from shrinkwrap) we don't want to bother + // resolving the dependencies of extraneous deps. + if (tree.loaded) return loadExtraneous(tree, log, next) asyncMap(tree.children.filter(function (child) { return !child.loaded }), function (child, done) { resolveWithExistingModule(child, tree, log, done) }, andForEachChild(loadDeps, andFinishTracker(log, next))) diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js index ab1bdd1f1912f..c9f465b321ca0 100644 --- a/lib/install/inflate-shrinkwrap.js +++ b/lib/install/inflate-shrinkwrap.js @@ -16,6 +16,7 @@ var childPath = require('../utils/child-path.js') module.exports = function (tree, swdeps, finishInflating) { if (!npm.config.get('shrinkwrap')) return finishInflating() + tree.loaded = true return inflateShrinkwrap(tree.path, tree, swdeps, finishInflating) } @@ -67,7 +68,7 @@ function inflateShrinkwrap (topPath, tree, swdeps, finishInflating) { return function () { var child = createChild({ package: pkg, - loaded: false, + loaded: true, parent: tree, fromShrinkwrap: pkg._from, path: childPath(tree.path, pkg),