menu      DavidRodenas

Install npm packages offline

Tags: teaching, npm

If you have no internet connection or you have a slow and no reliable connection you can do npm install from cache.

$ npm --cache-min 9999999 install

## Motivation

May be you are working in a plane, or in a train, just waiting in the airport, or in a conference and wifi is saturated. But you need to do an npm install of packages.

The easiest trick is the following: install packages from your cache. Probably you already have all packages and you do not care about updates.

## How it works?

Shortcut in your .bashrc

Add an alias for offline npm support if you are using bash (Mac or Linux), :

alias npm-offline="npm --cache-min 9999999 "

Use it to install as follows:

$ npm-offline install

Deployment environments

Use always --cache-min flag to ensure faster deployments.

alias npm="npm --cache-min 9999999 "

More information