docs: function resolveDependencies (pkg, cb) {
    if (!pkg) return topCb(new Error(
      "Package not found to resolve dependencies"))
    // link foo-1.0.3 to ROOT/.npm/{pkg}/{version}/node_modules/foo
  
    // see if it's bundled already
    var bundleDir = path.join( npm.dir, pkg.name, pkg.version
                             , "package", "node_modules" )
     , deps = pkg.dependencies && Object.keys(pkg.dependencies) || []
    log.verbose([pkg, deps], "deps being resolved")
    fs.readdir(bundleDir, function (er, bundledDeps) {
      if (er) bundledDeps = []
      bundledDeps.forEach(function (bd) {
        var i = deps.indexOf(bd)
        if (i !== -1) deps.splice(i, 1)
      })
  
      asyncMap(deps, function (i, cb) {
        var req = { name:i, version:pkg.dependencies[i] }
        log.verbose(req.name+"@"+req.version, "required")
  
        // see if we have this thing installed.
        fs.readdir(path.join(npm.dir, req.name), function (er, versions) {
          if (er) return cb(new Error(
            "Required package: "+req.name+"("+req.version+") not found."+
            "\n(required by: "+pkg._id+")"))
          // TODO: Get the "stable" version if there is one.
          // Look that up from the registry.
          var satis = semver.maxSatisfying(versions, req.version)
          if (satis) return cb(null, {name:req.name, version:satis})
          return cb(new Error(
            "Required package: "+req.name+"("+req.version+") not found. "+
            "(Found: "+JSON.stringify(versions)+")"+
            "\n(required by: "+pkg._id+")"))
        })
      }, function (er, found) {
        // save the resolved dependencies on the pkg data for later
        pkg._resolvedDeps = found
        cb(er, found)
      })
    })
  }