Use Git dependencies with npm and Node on Heroku
FYI if its on GitHub you can just specify the username/repository
and npm will do the rest.
{
"name": "application-name"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"coffee-script": "1.1.3"
, "express": "2.5.0"
, "less": "1.1.5"
, "jade": "0.17.0"
, "connect-redis": "1.2.0"
, "hiredis": "0.1.13"
, "redis": "0.7.1"
, "bcrypt": "0.4.1"
, "promised-io": "0.3.0"
, "jugglingdb": "juggy/jugglingdb"
, "nodemailer": "0.2.3"
}
}
Alternatively
Specify one of (git
/git+ssh
/git+http
/git+https
)://user@host/repo.git
urls
Fully documented
I don't know about this package, but I've got others to work with syntax like the following. On heroku, using a http reference to a tar.gz
package.json:
{
"name": "application-name"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"coffee-script": "1.1.3"
, "express": "2.5.0"
, "less": "1.1.5"
, "jade": "0.17.0"
, "connect-redis": "1.2.0"
, "hiredis": "0.1.13"
, "redis": "0.7.1"
, "bcrypt": "0.4.1"
, "promised-io": "0.3.0"
, "jugglingdb": "https://github.com/juggy/jugglingdb/tarball/master"
, "nodemailer": "0.2.3"
}
}
The problem is in their nodejs buildpack. I've sent a pull request to Heroku with a fix, but I have no idea if or when they'll respond. Fortunately, there's a not-very-well documented method for using a custom buildpack, which will allow you to work around the issue. I've forked heroku's nodejs buildpack and fixed the problem - available here:
https://github.com/chrisleishman/heroku-buildpack-nodejs/tree/git_fix
To use this, you're best creating your own github fork of https://github.com/heroku/heroku-buildpack-nodejs and then merging in my chrisleishman/git_fix
branch. E.g. (after forking):
git clone [email protected]:@YOUR-GITHUB-NAME@/heroku-buildpack-nodejs.git
cd heroku-buildpack-nodejs
git remote add chrisleishman git://github.com/chrisleishman/heroku-buildpack-nodejs.git
git fetch chrisleishman
git merge chrisleishman/git_fix
git push
You can then add the BUILDPACK_URL
config variable to your heroku app. E.g.
heroku config:add BUILDPACK_URL="git://github.com/@YOUR-GITHUB-NAME@/heroku-buildpack-nodejs.git
The next push to heroku should then use the custom buildpack, containing the fix.