docs: function linkModules (pkg, target, cb) {
    log.silly(pkg.modules, "linkModules")
    log.verbose(target, "linkModules")
    if (target === npm.root
        && !target.match(/node_modules$/)
        && -1 === require.paths.indexOf(target)) {
      log.warn("modules installing to "+target+", outside NODE_PATH")
    }
    if (!pkg.modules) pkg.modules = {}
    var mod = pkg.modules
  
    // FIXME: remove in 0.3.0, and uncomment this functionality in
    // lib/utils/read-json.js
    if (pkg.main) {
      mod["index.js"] = pkg.main
      delete pkg.main
    }
  
    var versionDir = path.join(npm.dir, pkg.name, pkg.version)
      , pkgDir = path.join(versionDir, "package")
  
    asyncMap(Object.keys(mod), function (key, cb) {
      writeShim
        ( path.join(pkgDir, mod[key])
        , path.join(target, key.replace(/\.js$/, '')+".js")
        , path.join(versionDir, "node_modules")
        , cb
        )
    }, function (er) {
      if (er) return cb(er)
      mkdir(target, function (er) {
        if (er) return cb(er)
        pkg._npmConfig = npm.config.get()
        pkg._env = {}
        Object.keys(process.env).forEach(function (e) {
          if (!e.match(/^npm_/i)) return
          pkg._env[e] = process.env[e]
        })
        pkg._npmPaths = { root : npm.root
                        , dir : npm.dir
                        , cache : npm.cache
                        , tmp : npm.tmp
                        , package : pkgDir
                        , modules : target
                        , dependencies : path.join(versionDir, "node_modules")
                        }
        var pkgCode = "module.exports = "
                    + JSON.stringify(pkg, null, 2)
                    + "\n"
        delete pkg._npmConfig
        delete pkg._npmPaths
        fs.writeFile(path.join(target,"package.json.js"), pkgCode, "utf8", cb)
      })
    })
  }