npm >= v3.x bundled with node >= v5 has broken this project.
preinstallscript is since then called after requests to npm registry are made.
This makes it impossible for
offline-npmto start as a registry server.
See BROKEN.md for detailed logs.
npm pack including all dependencies for offline installation with
offline-npm to your project to serve a npm compatible tgz file wich contains all dependencies for offline installation with
Additionally you can use
offline-npm -n to install packages from your local npm cache directory (Could be useful e.g. on travelling).
Even installs using
file: (requires node>=0.11) are considered.
Table of Contents
npm install -g offline-npm
Open terminal and go to your project you want to prepare for offline use. This folder needs to contain a
Prepare your project for offline use
This changes the
package.jsonfile and adds a
offlinefolder which will contain all your dependencies.
Pack your project
Now the local cache is changed and all your projects dependencies will be downloaded into
offline/cacheand packed into the npm tgz file.
Note: Take care not to add a global
Note: An existing
npm-shrinkwrap.jsonfile will get overwritten in this step to provide install without the
--registryswitch. A backup is stored in the
Transfer the resulting
<name>-<version>.tgzfrom the pack command onto a machine with no connectivity to the required registry. Execute this line from a terminal.
Now install the package with:
npm install [-g] <name>-<version>.tgz
Install packages from npm cache offline
If you want to use your local npm cache to install packages from use the option
offline-npm -n [-d]
-dshows you some server logs on the console.
Then install packages from the local npm cache with:
npm --registry http://localhost:4873 [-f] install <packagename>
-fswitch to force installing packages. This might be required if
npmstops stating "shasum" errors.
.npmignorefile. Otherwise all
package.tgzfiles for the offline installation will be missing.
If you want to exclude previously packed versions of the package you're working with use
The script needs access to
npm. It is assumed that
npmis installed alongside with
node. If you experience problems with correcty resolving
npm, add to your
<path_to_node_modules>is the path to the
node_modulesdir which contains npm.
If installation hangs try installing in verbose mode
`npm install <name-version>.tgz --verbose`
If you see that some
.lockin your files block you from progress, consider deleting them with
npm cache clean <pkg>[@<version>]
Copyright (c) 2014 commenthol
Software is released under MIT.