diff options
author | isaacs <i@izs.me> | 2010-09-02 03:49:58 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-09-02 03:50:30 +0400 |
commit | b3f15838ac94ab25eb2a24baf7f674b048b82db4 (patch) | |
tree | 54a5a5455a34d5d6fc7aa05bd94441411fac4156 /cli.js | |
parent | 3a63fdf2de9fe9605f8a2d63b1065d38d07e20ff (diff) |
throw if a bad version of node.
Diffstat (limited to 'cli.js')
-rwxr-xr-x | cli.js | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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") }) |