From b3f15838ac94ab25eb2a24baf7f674b048b82db4 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 1 Sep 2010 16:49:58 -0700 Subject: throw if a bad version of node. --- cli.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cli.js') 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") }) -- cgit v1.2.3