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.
1 Answer
A list of all packages can be found here http://registry.npmjs.org/-/all
var request = require('request'); var exec = require('child_process').exec; request('http://registry.npmjs.org/-/all', function(err, request, body) { install(Object.keys(JSON.parse(body))); }); function install(packages) { var pkg = packages.shift(); console.log('installing ' + pkg + '...'); exec('npm install ' + pkg + ' -g', function() { if (packages.length) install(packages); }); } - Being a node.js newbie, I had to install the request module using "npm install request" before it would workJohn Carse– John Carse2012-03-20 14:45:39 +00:00Commented Mar 20, 2012 at 14:45
-
http://registry.npmjs.org/-/allis incorrect.Hajitsu– Hajitsu2019-05-08 12:14:22 +00:00Commented May 8, 2019 at 12:14