Is there no better way to upgrade Node and its plugins?

I am by no means a virtuoso when it comes to Node, Grunt, etc., so when I ran into a Grunt plugin breaking (grunt-icon, to be exact: “grunticon now spawning phantomjs”), the only search result I could find was this issue which appears to be solved, but via grunt-icon update. So, I set about updating my grunt-icon installation.

So, how do you do that… :-/

Naturally, I Googled “windows update grunt-icon” and got a never-ending stream of results that all talked about installing grunt-icon… Thanks to a co-worker that knows Node pretty well, and a couple trips and stumbles after that, I found the solution.

Cutting to the chase, to update Node, Grunt, and all my Grunt plugins, this is what I did:

  1. Download the latest version of Node
  2. Install that Node version
  3. Manually hunt for the latest version numbers for Grunt and each Grunt plugin that you use (Google helps, of course, but then, if you can find the Github page, try checking for a Release Notes section, like this one for contrib-less)
  4. In your package.json file and you should see something like this:
      "dependencies": {
        "grunt": "0.4.5",
        "grunt-contrib-less": "0.11.1",
        "grunt-contrib-watch": "0.6.1",
        "grunt-contrib-uglify": "0.4.0",
        "grunt-grunticon": "1.2.0"
  5. Update each of those numbers to the latest versions you found
  6. Save the file
  7. From the command line, run npm install
  8. If all goes as planned, Node, which you already updated, should run through everything in your package.json file and check if you have that version installed; if not, download and install it.

This fixed my PhantomJS issue, though create another issue because Grunt changed its syntax, so I had to re-write some of the package.json references, but after, I had everything working again!

Is there no better way to do this? What I was hoping to find was something like:
node update -all
That would simply update Node, then Grunt, then all the plug-ins, to their latest stable versions.

Would love to hear about a better method.

Happy grunting,

3 Responses to Is there no better way to upgrade Node and its plugins?

  1. gwen says:

    I have a simple alias in my .bashrc to run a npm check update and the install updated version

    alias npmui=''npm-check-updates -u && sudo npm install'

  2. Dominykas says:

    You don’t have to hardcode version numbers exactly like that. You can use e.g. 0.4.x or ~0.4.5 (any 0.4) or ^0.4.5 (any 0.4 or higher) or even * (any latest) and then just npm update.

    Also npm outdated –depth=0 is very nice :)

  3. aarontgrogg says:

    Thanks to both gwen & Dominykas! Both of these options seem MUCH easier than my method described above… :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.