How to Install a NPM Module from GitHub Branch

By  on  

In my journey to work more quickly with a project containing loads of dependencies, I've come across a few techniques I've not needed to use before. I previously wrote about How to Push to a Git Remote Branch of a Different Name -- this time we'll talk about installing a module from another repository instead of a published version.

To install a module from a GitHub branch instead of a tagged and published NPM module, simply reference the username, repository, and branch name:

"dependencies": {
    "eth-ledger-bridge-keyring": "darkwing/eth-ledger-bridge-keyring#work-in-progress",
}

This pattern is useful for a host of reasons, especially when trying to rapidly develop from local branches. Feel free to leave off the branch name if you just want to use master branch!

Recent Features

  • By
    Write Better JavaScript with Promises

    You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...

  • By
    CSS vs. JS Animation: Which is Faster?

    How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps? This article serves as a point-by-point...

Incredible Demos

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!