Search code examples
gitdependenciesnpmbranchgit-tag

Depend on a branch or tag using a git URL in a package.json?


Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released.

How would I reference my fixed version in the dependencies of my package.json?


Solution

  • Solution 1

    From the npm docs, using a git URL:

    https://github.com/<user>/<project>.git#<branch>
    
    https://github.com/<user>/<project>.git#feature\/<branch>
    

    Don't use git:// protocol for GitHub, it is not longer supported

    Solution 2

    As of NPM version 1.1.65, you can use a shorten github URL:

    <user>/<project>#<branch>