Tuesday, January 31, 2012

NodeJS: install oddball tarballs with NPM

It is useful at times to install a head version of a module or a branch which is not in the npm.js repository. No big deal, if the module hosted on github.com. Npm can install from tar files available over http, and Github allows simple URL acces to tarballs.

The UI process: go to the repository of your choice, click on Code and select a branch. Otherwise go to Tags or Downloads on the right side of the page. Right-click on a tarball link of your liking and copy it to the clipboard. Then simply npm install <paste_here> install the module.
To directly enter the URL run

npm install https://github.com/USER/REPO/tarball/BRANCH_TAG_or_SHA

Keep in mind, that you may royally mess up versioning using this method. Be mindful.

No comments :

Post a Comment

Comments which in my opinion do not contribute to a discussion will be removed.