I need to install a \"global\" npm applications on an offline server.
It is easy to install a normal application:
npm install
and t
Using Yarn:
On the internet machine (configure local cache location):
yarn config set yarn-offline-mirror ~/yarn-offline-mirror/
On the offline machine (configure local cache location):
yarn config set yarn-offline-mirror ~/yarn-offline-mirror/
On the offline machine, Find out where is the global installation location:
yarn global bin
(Or set it with yarn config set prefix )
On the offline machine, add it to your path. E.g.:
echo 'export PATH=$PATH:'"$(yarn global bin)" >> ~/.bashrc
source ~/.bashrc # reload
On the internet machine, download forever's dependencies:
mkdir new-cli-forever/
cd new-cli-forever/
yarn add forever
Then copy new-cli-forever/yarn.lock and ~/yarn-offline-mirror/ to the offline machine. (rm -rf new-cli-forever/ is ok now.)
On the offline machine, install forever from local cache:
cp /path/to/imported/yarn.lock .
cp -n /path/to/imported/yarn-offline-mirror/* ~/yarn-offline-mirror/
yarn global add --offline forever
rm -f ./yarn.lock
For more info, see my post here: https://assafmo.github.io/2018/04/11/yarn-offline.html