The Problem

Different projects require different node versions

Not all projects have documentation (README.md)

People don't always read documentation

People that do read it, still forget to switch versions

Time is wasted thinking projects are broken that aren't

grunt-node-version

has 3 vital dependencies

grunt-node-version

Grunt is a task runner (read: automation tool).

It allows us to ensure that running projects, unit-tests, and deploys are all done the same way.

grunt-node-version

Node.js is a platform that uses the JavaScript runtime for building web applications.

A lot of Node.js projects depend on a specific version of Node.js.

Many of our projects at meltmedia run on Node.js.

grunt-node-version

NVM (Node Version Manager) is a command-line tool for maintaining multiple versions of Node.js on your system

A developer using NVM can easily install and switch between many versions of Node.js.

Implementation

  1. Define a node version in your package.json
  2. Load the task
  3. Prepend the task to each task list that is node version dependent

Using an incompatible version, with no compatible versions installed

Running "node_version" task
prompt: You do not have any node versions installed that satisfy this
project's requirements (>=0.10.0-0 <0.11.0-0). Would you like to
install the latest compatible version? (y/n):
$ no
Fatal error: Expected node >=0.10.0-0 <0.11.0-0, but found 0.8.25

or

$ yes
>> Installed node v0.10.17
Switched from node v0.8.25 to v0.10.17
(Project requires node >=0.10.0-0 <0.11.0-0)

Running "exec:run" (exec) task
Now using node v0.10.17
info: Welcome to DocPad v6.44.0
...

When can I use it?

Now.

grunt-node-version is already being used on at least 4 of our DocPad sites

Nicholas Cage is very excited to implement this plugin

Nicholas Cage being way too excited about a Grunt plugin

Questions?