I need to install pm2 and pm2-windows-service package globally on a computer without an internet connection. I have tried to save each package as a tarball on my own computer (with internet connection) like this:
npm pack pm2
npm pack pm2-windows-startup
Then I copy both tarball files 'pm2-4.2.3.tgz' and 'pm2-windows-startup-1.0.3.tgz' to the computer without internet connection and try to install globally as follow:
npm i -g pm2-4.2.3.tgz
npm i -g pm2-windows-startup-1.0.3.tgz
But I always have the same error ...
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/@pm2%2fagent failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
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'
Some suggestion to solve that?
1 Answer 1
According to npm documentation
Global install (with -g): puts stuff in /usr/local or wherever node is installed.
I haven't tried it myself but what I'd try to do is to take the dependency (with all subdependencies) and put it in the directory with your node. Something like <PATH_TO_NODE>/node_modules.
Then take the corresponding file from your local node_modules/.bin and put it in the <PATH_TO_NODE>
If you don't know where your node is installed, you can run this command in the terminal
npm config get prefix
Directories will be different on UNIX systems.