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
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-09-22 21:20:23 +0400
committerForrest L Norvell <forrest@npmjs.com>2015-02-27 13:43:53 +0300
commit7bf85cc372ab5698593b01e139c383fa62c92516 (patch)
treeee6cda72803a1a7817413d2ebbc3c9d09a255023
parent3f6061d75650441ee690472d1fa9c8dd7a7b1b28 (diff)
rm: npm rm <noargs> 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'.
-rw-r--r--lib/uninstall.js5
1 files 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 )
})