0

According to npm docs, this should work;

npm install ./package.tgz

So I try this globally for pm2 tarfile I have downloaded from pm2 github repo releases page;

npm install -g ./pm2-3.2.2.tar.gz

But I got this;

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/@pm2%2fagent failed, reason: getaddrinfo ENOTFOUND nb nb:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-01-29T08_16_17_112Z-debug.log

-

npm version: 5.6.0
node version: 9.4.0

Is it a bug?

Is there any other way to install pm2 (and any other) package offline?

1

1 Answer 1

0

I found out that I need to take care of the dependencies of the package as well. I got the solution in this answer of a similar question;

Well.... after a day trying to make it work with above references (npmbox or offline-npm) came up with something way much simpler. Thanks to npmbox I have to say. The idea is the keep the cache from the instance that has online access and then use it in the one offline.

In machine with internet:

1 - clear npm cache: npm cache clear

2 - install package, lets say its x.y.z: npm install -g package.x.y.z

3 - copy cache in to a folder... let's call it whatever (I assume npm cache is in root folder, not absolutely sure about that): cp -R /.npm/* /cache-whatever-folder

In machine with no internet:

4 - take this cache-whatever-folder to the instance with no internet and after that, clean cache and install with it (I won't indicate how to copy the folder :)

npm cache clear

npm install --global --cache /cache-whatever-folder --optional --cache-min 99999999999 --shrinkwrap false package.x.y.z

Done

Answer link: https://stackoverflow.com/a/43793301/169534

1
  • I'll be wary of your method. npm cache has this to say on their docs: "npm makes no guarantee that a previously-cached piece of data will be available later". So your cache may be incomplete or corrupted.
    – Cardin
    Aug 21, 2019 at 23:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .