How to install npm -g on offline server


Question

I need to install a "global" npm applications on an offline server.

It is easy to install a normal application:

npm install

and then pack up the resulting files. Either manually or using npm pack.

However, how can I install global application (that has a install script of some sort) such as forever without Internet?

npm install -g forever
1
27
7/2/2012 1:59:35 PM

Accepted Answer

try npmbox, it is the new name of npmzip which will allow you to install offline npm packages by one file

20
10/29/2013 6:51:14 PM

You can install stuff from a tarball file, check out the npm documentation. You can find the URL of the forever tarball with npm view forever dist.tarball and download that. Try something like this:

curl -so forever.tar.gz `npm view forever dist.tarball 2> /dev/null`
npm install ./forever.tar.gz -g

But you might have to do this for all of the dependencies as well. There might be a better way but this is what I've found in my search.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon