From ac4a7a6a40094d81c406a38d7517040db21e2ead Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Mon, 21 Mar 2016 15:54:28 +0530 Subject: [PATCH 1/2] Fix --- utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.js b/utils.js index 24c9bc7..634e053 100644 --- a/utils.js +++ b/utils.js @@ -34,7 +34,7 @@ exports.patchData = function ( data ){ }; var fetchAndCacheMetadataCmd =[ - 'mkdir $packageCacheDir', + 'mkdir -p $packageCacheDir', 'wget -nv "http://$REGISTRY_NAME/$packageName" -O $cacheFile || { wgetExitStatus=$? && rm $cacheFile; exit $wgetExitStatus ; }' ].join( ';' ); From 4f198ed53f22954777e82322da12b7e5b2bb8188 Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Sat, 26 Mar 2016 18:17:43 +0530 Subject: [PATCH 2/2] Fix: default Port 8080 is very famous port. So , make some less famous port as default port --- README.md | 10 ++++++---- bin/www | 9 +++------ config.js | 4 +++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0fa32c1..b2d9635 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,12 @@ Supper simple NPM registry server for offline NPM install *OR* `node node_modules/.bin/npm-offline-registry` -* Now the server will run on [http://localhost:8080](http://localhost:8080) -* use `http://localhost:8080/` as registry while doing npm install - - Either use `npm install --registry http://localhost:8080/ [package-name]...` - - Or permanently set config variable `npm config set registry http://localhost:8080/` +* Now the server will run on [http://localhost:8234](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? diff --git a/bin/www b/bin/www index cbcf1ce..0961fde 100755 --- a/bin/www +++ b/bin/www @@ -6,12 +6,13 @@ var app = require('../app'); var http = require('http'); +var config = require( __dirname + '/../config' ); /** * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || '8080'); +var port = normalizePort( config.PORT ); app.set('port', port); /** @@ -81,9 +82,5 @@ function onError(error) { */ function onListening() { - var addr = server.address(); - var bind = typeof addr === 'string' - ? 'pipe ' + addr - : 'port ' + addr.port; - console.log('Listening on ' + bind); + console.log('Listening on http://' + config.LOCAL_REGISTRY ); } diff --git a/config.js b/config.js index 9ae423e..0c153cd 100644 --- a/config.js +++ b/config.js @@ -2,7 +2,7 @@ var defaultConfig = { NPM_PATH : process.env.HOME + '/.npm', REGISTRY_NAME : 'registry.npmjs.org', - LOCAL_REGISTRY : 'localhost:8080', + PORT: 8234 }; var config = {}; @@ -11,5 +11,7 @@ Object.keys( defaultConfig ).forEach( function(v){ config[v] = process.env[v] || defaultConfig[v]; }); +config.LOCAL_REGISTRY = 'localhost:' + config.PORT; + module.exports = config;