Fork and patch npm moduels hosted on GitHub
I have read How to fork & patch npm modules and followed the instructions but I couldn't make it work for me. Looking at npm log I figured that the problem was with zip files being downloaded and not tarballs. So here's the trick on how to include your GitHub repository correctly in npm
:
- Go to fork's page
- On the right side of the page you will find "Download ZIP" button (or whatever it is that you are seeing). Right-click on it and copy the link it points to. It should be something like
https://github.com/SoftwareMarbles/jugglingdb/archive/master.zip
. - Edit the link's URL replacing
archive
withtarball
and removing the.zip
extension. You should end up with something likehttps://github.com/SoftwareMarbles/jugglingdb/tarball/master
. - Paste that into your
package.json
instead of the package's version:
"jugglingdb": "https://github.com/SoftwareMarbles/jugglingdb/tarball/master"
And that's it - npm install
works as it should and installs the module from the link.
You can do the same for a particular commit (and actually this is what originally this protip recommended):
- Go to fork's page
- Go to commits
- On the right side of the commit you want to use click "Browse code"
- On the browse code page right-click on "Download ZIP" button (or whatever it is that you are seeing) and copy . It should be something like this
https://github.com/SoftwareMarbles/express-jsend/archive/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d.zip
. - Edit that URL replacing
archive
withtarball
and removing the.zip
extension. You should end up with something likehttps://github.com/SoftwareMarbles/express-jsend/tarball/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d
. - Paste that into your package.json instead of the version. Like this:
"express-jsend": "https://github.com/SoftwareMarbles/express-jsend/tarball/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d"
Written by Ivan Erceg
Related protips
1 Response
You can also reference the package via git tag.
watsoncj/connect-session-sequelize
has tag 1.0.1
package.json:
"connect-session-sequelize": "https://github.com/watsoncj/connect-session-sequelize/archive/1.0.1.tar.gz",
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Npm
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#