title: Native Support for Promises in Node.js
body: <p>Is there native support for promises in current versions of Node.js? </p>
  
  <p>Node.js uses the V8 engine. This JavaScript engine is also used by Chrome, and Chrome 32 has native support for promises. But I can't seem to get promises to work (natively) in Node.js.</p>
  
  <p>I've tried the following code in Chrome 32 and it works.</p>
  
  <pre><code>var promise = new Promise(function(resolve, reject) {
    // do a thing, possibly async, then…
  
    if ( 1===1 /* everything turned out fine */) {
      resolve("Stuff worked!");
    }
    else {
      reject(Error("It broke"));
    }
  });
  
  promise.then(function( message ) {
    console.log( message );
  },
  function( err ) {
    console.log( err );
  });
  </code></pre>
  
  <p>However, when I try this same code in Node.js, I get:</p>
  
  <pre><code>var promise = new Promise(function(resolve, reject) {
                     ^
  ReferenceError: Promise is not defined
  </code></pre>
  
  <p>This code is from the excellent tutorial:</p>
  
  <p><a href="http://www.html5rocks.com/en/tutorials/es6/promises/" rel="noreferrer">http://www.html5rocks.com/en/tutorials/es6/promises/</a></p>