Loading valid CSON always returns [TypeError: undefined is not a function]

I am using the exact CSON from the official CSON docs

{
    # an array
    abc: [
        'a'
        'b'
        'c'
    ]

    # an object
    a:
        b: 'c'
}

Loading this file (saved in test.cson) always returns an error:

#!/usr/bin/env node

var CSON = require('cson'),
  log = console.log.bind(console);

var config = CSON.parseFileSync('test.cson')
if ( Object.prototype.toString.call(config) === '[object Error]' ) {
  log('Error loading file', config)
  process.exit(1)
}

log('winning')

Running this always returns:

Error loading file [TypeError: undefined is not a function]

How can I load a CSON file?

I copy/pasted your exact code and it's working perfectly in my system, and printing out config shows me the correct object. Some things for you:

  1. (What I think it's most likely your mistake) Make sure you have installed the CSON library! In the folder of your script, run:
    npm install cson
  2. Check if the file test.cson exists and is readable.

If that doesn't help, you need to better understand where the issue is.
Before using the CSON library, try adding a console.log(CSON). Before your "if", then, add a console.log(config). What do you see?

The problem was running an unstable (0.11) version of node - I'd switched to another machine where I was working on something which required generators. At the time of writing, CSON does not work on node 0.11.