From 7bf85cc372ab5698593b01e139c383fa62c92516 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 22 Sep 2014 10:20:23 -0700 Subject: rm: npm rm globally removes (unlinks) '.' Fixes #4005, #6248. What's interesting is that the comment in the code seems to indicate that this was *always* the intent. But somewhere along the line, that seems to have broken. This makes 'npm link' be un-done by running 'npm unlink'. --- lib/uninstall.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/uninstall.js b/lib/uninstall.js index 68869f579..600c68197 100644 --- a/lib/uninstall.js +++ b/lib/uninstall.js @@ -28,12 +28,11 @@ function uninstall (args, cb) { if (args.length) return uninstall_(args, nm, cb) // remove this package from the global space, if it's installed there - if (npm.config.get("global")) return cb(uninstall.usage) - readJson(path.resolve(npm.prefix, "package.json"), function (er, pkg) { + readJson(path.resolve(npm.localPrefix, "package.json"), function (er, pkg) { if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er) if (er) return cb(uninstall.usage) uninstall_( [pkg.name] - , npm.dir + , npm.globalDir , cb ) }) -- cgit v1.2.3