A proxy server for npm to publish packages to a child/private registry and install packages from a child or parent/public registry (if the child doesn't have the package).
A proxy server built on node-http-proxy for npm to publish packages to a child/private registry and install packages from a child or parent/public registry (if the child doesn't have the package).
We ran into a few issues updating our npm repo with newer npm and npmjs.org checkouts.
Around the introduction of the npm-registry-client (version ~1.1.25), npm required couchdb auth credentials for package GET requests (for security reasons I think). We use different credentials for our public and private repos and couldn't naively proxy GET requests to the public npmjs.org anymore.
@wyrdvans fixed these issues by setting up vhosts, replicating the npmjs.org registry and our private registry. This also improved performance on our network, reduced load on the public npmjs.org, made it easier to run security audits on our node dependencies, and removed the need to run this proxy.
Hopefully we can support multiple npm repositories in npm itself instead of needing a fully replicated repo or an npm proxy:
Requires node version 0.6.6 or newer. Untested on node 0.8.
npm install npm-proxy
- Run locally:
- Install npm-proxy globally
sudo npm install -g npm-proxy
- Add the following line to the
/etc/couchdb/local.inion the child npm registry:
npm_proxy = /usr/bin/npm-proxy --child-registry-target
- Restart couchdb and make sure npm-proxy started with it
Usage: npm-proxy [options] Options: -h, --help output usage information -V, --version output the version number -t, --target [localhost:8080] hostname and port to listen on or url -c, --child-registry-target [localhost:5984] NPM registry to push packages and pull from first -p, --parent-registry-target [registry.npmjs.org:80] NPM registry to pull packages from if the child doesn't have it
Once the proxy is running point npm to it using any of the methods from "Using the registry with the npm client" section of the npmjs.org project.
Janky OSX Testing on for my machine:
# brew install couchdbrm npm-shrinkwrap.jsonnpm install -d . --registry=make clean setup-couchcouchdb # start couchmake setup-npmjs# start npm-proxy./bin/npm-proxy -c localhost:5984make acceptance test
- ANSI colors for log output
- 100% unit test coverage
- For acceptance tests, setup and teardown multiple processes using node
- For integration tests, record and playback npm requests and npmjs.org responses