title: SyntaxError: Unexpected token function - Async Await Nodejs
body: <p>I was experimenting on using Node version <strong>6.2.1</strong> with some of my code. Had plans to migrate most of the hyper-callback oriented codes to something that looks cleaner and maybe performs better.</p>
  
  <p>I have no clue why, the terminal throws up an error when I try to execute the node code.</p>
  
  <p><strong>helloz.js</strong></p>
  
  <pre><code>(async function testingAsyncAwait() {
      await console.log("Print me!");
  })();
  </code></pre>
  
  <p><strong>Logs-</strong></p>
  
  <pre><code>BOZZMOB-M-T0HZ:rest bozzmob$ node helloz.js 
  /Users/bozzmob/Documents/work/nextgennms/rest/helloz.js:1
  (function (exports, require, module, __filename, __dirname) { (async function testingAsyncAwait() {
                                                                       ^^^^^^^^
  SyntaxError: Unexpected token function
      at Object.exports.runInThisContext (vm.js:53:16)
      at Module._compile (module.js:513:28)
      at Object.Module._extensions..js (module.js:550:10)
      at Module.load (module.js:458:32)
      at tryModuleLoad (module.js:417:12)
      at Function.Module._load (module.js:409:3)
      at Function.Module.runMain (module.js:575:10)
      at startup (node.js:160:18)
      at node.js:456:3
  BOZZMOB-M-T0HZ:rest bozzmob$ node -v
  v6.2.1
  </code></pre>
  
  <p>What am I missing? Please throw me some light on the same.</p>
  
  <hr>
  
  <p><strong>Update 1:</strong></p>
  
  <p>I tried to use Babel as Quentin suggested, But, I am getting the following error still.</p>
  
  <p><strong>Updated Code-</strong></p>
  
  <pre><code>require("babel-core/register");
  require("babel-polyfill");
  
      (async function testingAsyncAwait() {
          await console.log("Print me!");
      })();
  </code></pre>
  
  <p><strong>Logs-</strong></p>
  
  <pre><code>BOZZMOB-M-T0HZ:rest bozzmob$ babel helloz.js &gt; helloz.trans.js
  SyntaxError: helloz.js: Unexpected token (3:7)
    1 | require("babel-polyfill");
    2 | 
  &gt; 3 | (async function testingAsyncAwait() {
      |        ^
    4 |     await console.log("Print me!");
    5 | })();
  </code></pre>