diff options
author | isaacs <i@izs.me> | 2010-11-29 22:18:18 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-11-29 22:18:18 +0300 |
commit | 1fe70f7cf0aebbcad463a5b432909cc3860bc61a (patch) | |
tree | 751eb3565809cfb8049fe83df295668c707d84e0 /npm.js | |
parent | 13d7966c573c1cc838b6814b66c2552e52b8ea9c (diff) |
Guard against using npm programmatically wrong.
Diffstat (limited to 'npm.js')
-rw-r--r-- | npm.js | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -89,6 +89,9 @@ var commandCache = {} Object.keys(abbrevs).forEach(function (c) { Object.defineProperty(npm.commands, c, { get : function () { + if (!loaded) throw new Error( + "Call npm.load(conf, cb) before using this command.\n"+ + "See the README.md or cli.js for example usage.") var a = npm.deref(c) if (commandCache[a]) return commandCache[a] return commandCache[a] = require(__dirname+"/lib/"+a) |