summaryrefslogtreecommitdiff
path: root/deps/npm/lib/utils/find-prefix.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/utils/find-prefix.js')
-rw-r--r--deps/npm/lib/utils/find-prefix.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/deps/npm/lib/utils/find-prefix.js b/deps/npm/lib/utils/find-prefix.js
index c3ff85f59..a61d9e136 100644
--- a/deps/npm/lib/utils/find-prefix.js
+++ b/deps/npm/lib/utils/find-prefix.js
@@ -34,7 +34,12 @@ function findPrefix_ (p, original, cb) {
}
fs.readdir(p, function (er, files) {
// an error right away is a bad sign.
- if (er && p === original) return cb(er)
+ // unless the prefix was simply a non
+ // existent directory.
+ if (er && p === original) {
+ if (er.code === "ENOENT") return cb(null, original);
+ return cb(er)
+ }
// walked up too high or something.
if (er) return cb(null, original)