Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I tell npm to install all packages available in its repository? I have to work offline, so I'm preparing a virtual machine to code in node.js and I don't know if I may end up needing some package in the future, so I wish I was able to install all of them beforehand.

share|improve this question

migrated from Aug 1 '11 at 5:25

This question came from our site for professional and enthusiast programmers.

up vote 4 down vote accepted

A list of all packages can be found here

var request = require('request');
var exec = require('child_process').exec;

request('', function(err, request, body) {

function install(packages) {
    var pkg = packages.shift();
    console.log('installing ' + pkg + '...');
    exec('npm install ' + pkg + ' -g', function() {
        if (packages.length)
share|improve this answer
Being a node.js newbie, I had to install the request module using "npm install request" before it would work – John Carse Mar 20 '12 at 14:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.