diff --git a/bin/npm.js b/bin/npm.js index b508757346ca5..32d74b34e5161 100755 --- a/bin/npm.js +++ b/bin/npm.js @@ -17,6 +17,12 @@ var fs = require("../lib/utils/graceful-fs") , types = configDefs.types , nopt = require("nopt") +// if npm is called as "npmg" or "npm_g", then +// run in global mode. +if(path.basename(process.argv[1]).slice(-1) === "g") { + process.argv.splice(1, 1, "npm", "-g") +} + log.verbose(process.argv, "cli") var conf = nopt(types, shorthands) diff --git a/package.json b/package.json index 04cc45a409e72..9f71636e9dea9 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ , "bin" : "./bin" } , "main" : "npm" -, "bin" : "./bin/npm.js" +, "bin" : { "npm" : "./bin/npm.js" + , "npm_g" : "./bin/npm.js" + , "npm-g" : "./bin/npm.js" } , "dependencies" : { "semver" : "1" , "abbrev" : "1"