Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/npm.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-03-08 04:14:08 +0300
committerisaacs <i@izs.me>2011-03-22 01:55:51 +0300
commit72802252a07b8090f947435238a3fb20ac121974 (patch)
tree5d4f13878241dd3b27493fc832c60ac7ab805b4b /npm.js
parent57ceabbe0220f1382ba2d20667b83ae78e21ffd2 (diff)
walk up the --prefix to a non-node_modules dir
Diffstat (limited to 'npm.js')
-rw-r--r--npm.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/npm.js b/npm.js
index ba063421b..c98038f47 100644
--- a/npm.js
+++ b/npm.js
@@ -139,6 +139,10 @@ npm.load = function (conf, cb_) {
if (!npm.config.get("global")) {
npm.config.set("prefix", process.cwd())
}
+ var p = npm.config.get("prefix")
+ while (path.basename(p) === "node_modules") {
+ npm.config.set("prefix", p = path.dirname(p))
+ }
loaded = true
loadListeners.forEach(function (cb) {
process.nextTick(function () { cb(er, npm) })