You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Harish.K 4770262171 added Command line wrapper which will use local regisry to install packages 9 years ago
bin added Command line wrapper which will use local regisry to install packages 9 years ago
test More tests 10 years ago
.gitignore Initial commit 10 years ago
LICENSE Initial commit 10 years ago
README.md Fix: 10 years ago
app.js Tests passed 10 years ago
config.js Fix: 10 years ago
package.json added Command line wrapper which will use local regisry to install packages 9 years ago
utils.js Fix 10 years ago

README.md

npm-offline-registry

Supper simple NPM registry server for offline NPM install

Usage

  • install this npm mpdule

    npm i harish2704/npm-offline-registry

  • Run local npm-registry server

    npm-offline-registry OR node node_modules/.bin/npm-offline-registry

  • Now the server will run on http://localhost:8234

  • use http://localhost:8234/ as registry while doing npm install

    • Either use npm install --registry http://localhost:8234/ [package-name]...
    • Or permanently set config variable npm config set registry http://localhost:8234/

NOTE: *default port can be changed by setting PORT environment variable *

How it is working?

  • When ever we do npm install in normal condition, the npm tool will keep a cache directory of the files which was downloaded by npm tool.
  • Default location of this cache directory is ~/.npm for UNIX machines
  • npm-offline-registry tool will serve the requests using the cached versions of the files.
  • If a package/version is not found on cache, it is fetched from main npm registry. Then is properly inserted in to npm's cache directory.

Dependencies

Currently this tool is using following unix commands to manipulate npm's cache directory.

  • wget for downloading the content from main npm registry
  • mkdir with -p option
  • tar command with gzip uncompresion

I believe all the above said tools will be available in a typical UNIX machine.

Configurations

Please check config.js. All config values can be over-written by environment-variables