Bitten by package versions...

My first Node.js service was a simple personal logging service that I put up at the beginning of the year. It was a personal project, hacked in a couple of weeks of very sporadic work and I didn't pay much attention to its deployment. So today I tried to move its database backend to Cloudant (moving away from IrisCouch which for me has been extremely unreliable) but in the meantime (the last deployment was 10 months ago) the connection between the local repository and Heroku app got lost so I instantiated it as a different app (luckily as you'll see later).

But since my package.json promiscuously specified "*" on all module versions, the app of course didn't work. The service uses Jade Template Engine and its version 1.0 was released just yesterday (just my luck!) and of course it didn't work with my old code. And who knows how many other modules were updated since February.

I tried updating but it was too much for a quick job I wanted to do so at the end I tried to revert to the known versions of packages that was running in my old Heroku app. This is why I say I was lucky to have created a new app - I was able to get all the package versions from the old app still stored on Heroku and update the new app's package.json.

The procedure was simple - I used heroku run to cat contents of each node_modules/<module>/package.json and then put the version I read from there in my root package.json. I tried doing npm list but that didn't work as apparently npm wasn't installed in the old app (not sure how but I got an error using it so I switched to manually listing versions).

And it worked well enough - I just had to revert some changes I already made to my Jade templates. One git push heroku master later the service was up again.

Author

Ivan Erceg

Software shipper, successful technical co-founder, $1M Salesforce Hackathon 2014 winner