GarthDB

a blog.

Using the Latest Stable Version (v0.6.10) of NodeJS on Heroku

Update: you can also use nodejs-versions in the labs plugin.

If you’re starting some NodeJS fun on Heroku, you might find that it is not using the latest stable version (as of today is v0.6.10).  To help fix this problem Heroku has provided the means to build your own buildpacks with the Cedar Stack.  This article has one of the better tutorials, but it requires you to use aws; which just seemed silly for something as standard using the latest stable version.

I was in the process of building my own buildpack, when I found Heroku has already provided the stable versions of Node and NPM.

To use these:

  1. Fork Heroku’s NodeJS buildpack
  2. Clone your new repository locally

  1. Edit the bin/compile

Replace this:

with this:

  1. Commit and push changes

  1. Create a new Heroku application

I haven’t found any documentation on how to change the buildpack url setting in an existing application, so I’m going to assume it isn’t possible.  If anyone knows otherwise, feel free to let me know.

3 Comments

  1. Thanks for the link back to my article. BTW – at the time I wrote it, that was the *only* way of using a different version of Node.js on Heroku; the use of AWS was a required step – hardly ‘silly’ – and obsoleted by later work…

    You noted the labs feature in your update – this has now been released to production, so it’s super easy to pick versions of Node.js and npm from http://heroku-buildpack-nodejs.s3.amazonaws.com/manifest.nodejs and http://heroku-buildpack-nodejs.s3.amazonaws.com/manifest.npm respectively – see http://devcenter.heroku.com/articles/nodejs-versions. I’ll go back and update my blog entry too…

    BTW – buildpack is expressed in the BUILDPACK_URL env var, which can be modified after the fact with heroku config, just like any other env var, though, if I remember correctly, you may need to redeploy for it to take effect, since changing env vars normally only triggers a restart.

    • GarthDB says:

      Hey Pat, thanks for the comment.

      I apologize for insinuating that your solution wasn’t helpful. Your blog post was the only solution I could find for the problem. I appreciate you posting it.

      It isn’t easy finding some of the documentation on nodejs support on heroku, but I love the platform, so I’m happy to figure it out and push through.

      Thanks for the note about the BUILDPACK_URL env var. I had noticed it somewhere in github comments. I’ll update my post.

  2. Kenokabe says:

    heroku config:add BUILDPACK_URL=”http://github.com/[your github username]/heroku-buildpack-nodejs.git”
    works from your existing app directory.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>