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/cli.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-09-02 03:49:58 +0400
committerisaacs <i@izs.me>2010-09-02 03:50:30 +0400
commitb3f15838ac94ab25eb2a24baf7f674b048b82db4 (patch)
tree54a5a5455a34d5d6fc7aa05bd94441411fac4156 /cli.js
parent3a63fdf2de9fe9605f8a2d63b1065d38d07e20ff (diff)
throw if a bad version of node.
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli.js b/cli.js
index b6aa36dad..944bce743 100755
--- a/cli.js
+++ b/cli.js
@@ -56,6 +56,16 @@ if (printVersion) {
if (vindex !== -1) arglist.splice(vindex, 1)
} else log(npm.version, "version")
+// make sure that this version of node works with this version of npm.
+var semver = require("./lib/utils/semver")
+ , nodeVer = process.version
+ , reqVer = npm.nodeVersionRequired
+if (!semver.satisfies(nodeVer, reqVer)) {
+ var badNodeVersion = new Error(
+ "npm doesn't work with node " + nodeVer + "\nRequired: node@" + reqVer)
+ throw badNodeVersion
+}
+
process.on("uncaughtException", errorHandler)
process.on("exit", function () { if (!itWorked) log.win("not ok") })