Since I just spent about an hour setting up the dependencies for my Harp.js website on Heroku, I figured I would document the process here.

The guide that’s up on their website is outdated, as far as I can tell. Perhaps the buildpack is the focus of attention now. I tried that once, but since I want to know how to do it anyway, I did it by hand when there was some kind of error. Of course, I am new to the Node.js world, so… YMMV.

TL;DR: Here is the final version that worked for me. Be sure to add /node_modules to .gitignore after npm install.

Anyway, I have nearly decided to host my website on Heroku after its launch actually happens. Reasons are many, but include the following:

  1. Heroku will most likely be cheaper than my current set up.
  2. Ipage, who I use now, has been less-than-optimal for a while now: renewing me silently at an increased rate, down times, etc. It is time for a move of some sort.
  3. Heroku and its ilk are the up and coming thing in the tech world right now. I want experience using it in some fashion under my belt.
  4. This site is working just fine, and that is a good enough recommendation for me.

In any event, I created a heroku app for the site, following the guide’s instructions, and what to You know? An error appears.

Checking the logs, It is a missing dependency… which I found odd. It ran fine on my machine, and I followed the instructions on the site to a T. But anyway, I then began another trek through dependency hell in order to solve this.

What it comes down to is that it seems the guide assumes there will be some kind of automatic dependency resolution, whereas (much like Slackware Linux) Heroku did not seem to be providing that… or, rather the version of npm heroku was using didn’t.

Eventually, I got through every single dependency it wanted… And here is the resulting package.json file. But then, once I deployed it, I did something crucial: I uploaded the working project to Github for the first time. And then, looking at the pushed project, I had the answer.

It had been using the locally built packages which were in the repo, something that (in a separate article I found halfway through dependency hell, trying to follow best practices) Heroku advises against because of this very reason.

So, in short, the guide on the Harp.js website doesn’t have the crucial step of adding the /node_modules directory et al to the .gitignore file associated with the project before committing the setup for Heroku.

Had I been more experienced with npm or Node.js in general, I might have noticed that omission and just done it myself. But since Harp.js is not targeted exclusively towards the Node.js crowd, and considering they took the time to describe a fairly common part of deploying a Node.js project complete with [boilerplate][guide] code, I feel as though that should be mentioned somewhere in the guide.

As I was writing this post, they contacted. I’ve responded to them this morning, and will update this post after I hear back from them.

At least it is here now, though. HTH!

Categories:  software 
Tags:  heroku  webdev  process  example