I want to look through the package.json files of all packages installed globally and locally via npm, but not sure how to do it globally?
I know process.execPath will get me the directory to the globally installed exectuables, but not sure where to go from there.
Probably the easiest thing to do is use the NPM api. First 'npm link npm' in your project. Then you can call the NPM object to enumerate modules. For example:
var npm = require('npm');
npm.load({}, function(err, npm) {
npm.config.set("global", true);
npm.commands.list([], true, function(err, pkgInfo) {
console.log(pkgInfo);
});
});