Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

list install targets when range or tag fails

  • Loading branch information...
commit 87f74018d91d4c8872445595406605dcf53b89fa 1 parent 073f072
@isaacs isaacs authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 lib/install.js
View
16 lib/install.js
@@ -119,10 +119,11 @@ function install_ (pkg, reg, seen, mustHave, pkglist, cb) {
var tags = data["dist-tags"]
if (!tags[tag]) cb(new Error(
"Tag not found: "+data.name+"@"+tag
- +"\nValid tags: "+Object.keys(tags).map(JSON.stringify).join(",")))
+ +"\nValid install targets for "+data.name+": "
+ +installTargets(data)))
install_(data.name+"@"+tags[tag], reg, seen, mustHave, pkglist, cb)
} else {
- log(tag, pkg+" range")
+ log(pkg, "range")
// prefer the default tag version.
var defTag = npm.config.get("tag")
, satis
@@ -131,11 +132,20 @@ function install_ (pkg, reg, seen, mustHave, pkglist, cb) {
else satis = semver.maxSatisfying(Object.keys(data.versions), range)
if (!satis) return cb(new Error(
- "No satisfying version found for '"+data.name+"'@'"+range+"'"))
+ "No satisfying version found for '"+data.name+"'@'"+range+"'"
+ +"\nValid install targets for "+data.name+": "
+ +installTargets(data)))
install_(data.name+"@"+satis, reg, seen, mustHave, pkglist, cb)
}
})
}
+function installTargets (data) {
+ return Object.keys(data["dist-tags"])
+ .concat(Object.keys(data.versions))
+ .map(JSON.stringify)
+ .join(", ") || "(none)"
+}
+
function getData (name, cb) {
var data = npm.get(name)
if (data) return cb(null, data)
Please sign in to comment.
Something went wrong with that request. Please try again.