Compile and flash using node.js

I’m trying to compile and flash using node.js. For some reason I never reach the promise callback or error when testing the example in the SDK docs:

particle.compileCode({ files: { 'led.cpp': './led.cpp'},  auth: token }).then(
	  function(data) {
	    console.log('Code compilation started successfully:', data);
	  }, function(err) {
	    console.log('An error occurred while compiling the code:', err);
	  });

‘led.cpp’ contains the “blink a led” example.

I’d love to see an example of how to use particle.compileCode and particle.flashDevice together.