Skip to content

Instantly share code, notes, and snippets.

@blakek
Created August 14, 2015 17:49
Show Gist options
  • Save blakek/e3a18e0de13165f4719d to your computer and use it in GitHub Desktop.
Save blakek/e3a18e0de13165f4719d to your computer and use it in GitHub Desktop.
Install packages using npm
var npm = require('npm');
function npm_ready (err) {
if (err) {
console.log(err);
}
console.log('Searching...');
npm.commands.search(['wa-source-'], false, function (err, data) {
console.log('Search done.');
if (err) {
console.log(err);
}
console.log('Installing...');
npm.commands.install(__dirname + '/test', Object.keys(data), function (e, data) {
console.log('Install done.');
console.log('Error:');
console.log(e);
console.log('Data:');
console.log(data);
});
});
}
npm.load(npm_ready);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment