title: NodeJS / Babel SyntaxError Unexpected token
body: <p>I've been trying to pull in a lot of Babel functionality to a React / GraphQL project that I am mostly writing by hand. But I tried to use this build script to generate by schema.graphql file: </p>
  
  <pre><code>  import fs from 'fs';
    import path from 'path';
    import { graphql } from 'graphql';
    import { introspectionQuery, printSchema } from 'graphql/utilities';
  
    import schema from '../server/schema';
  
    let file_schema_json = path.join(__dirname, '../graphql/schema.json');
    let file_schema_graphql = path.join(__dirname, '../graphql/schema.graphql');
  
    // Save JSON of full schema introspection for Babel Relay Plugin to use
    async function createJson( )
    {
      var result = await( graphql( schema, introspectionQuery ) );
      if( result.errors )
      {
        console.error( 'ERROR! ' );
        console.error( 'ERROR introspecting schema: ', JSON.stringify(result.errors, null, 2) );
      }
      else
      {
        fs.writeFileSync( file_schema_json, JSON.stringify(result, null, 2) );
        console.log( 'Written: ' + file_schema_json );
      }
    }
  
    // Save user readable type system shorthand of schema
    fs.writeFileSync( file_schema_graphql, printSchema( schema ) );
    console.log( 'Written: ' + file_schema_graphql );
  
    createJson( );
  </code></pre>
  
  <p>and then I ended up with: </p>
  
  <pre><code>  /Users/lorm/projects/aggregated_centralized_api/node_modules/babel-core/lib/transformation/file/index.js:591
          throw err;
          ^
  
    SyntaxError: /Users/lorm/projects/aggregated_centralized_api/scripts/build-schema.js: Unexpected token (12:6)
      10 | 
      11 | // Save JSON of full schema introspection for Babel Relay Plugin to use
    &gt; 12 | async function createJson( )
         |       ^
      13 | {
      14 |   var result = await( graphql( schema, introspectionQuery ) );
      15 |   if( result.errors )
  </code></pre>
  
  <p>But I copied all the dependencies that I could think of: </p>
  
  <pre><code>"dependencies": {
  "babel-cli": "^6.8.0",
  "babel-core": "^6.8.0",
  "babel-eslint": "^6.0.4",
  "babel-loader": "^6.2.4",
  "babel-plugin-react-transform": "^2.0.2",
  "babel-plugin-transform-async-to-generator": "^6.8.0",
  "babel-polyfill": "^6.8.0",
  "babel-preset-es2015": "^6.6.0",
  "babel-preset-react": "^6.5.0",
  "babel-preset-stage-0": "^6.5.0",
  "babel-relay-plugin": "^0.8.1",
  "babel-relay-plugin-loader": "^0.8.1",
  "babel-runtime": "^6.6.1",
  "body-parser": "1.15.1",
  "dataloader": "1.1.0",
  "dotenv": "2.0.0",
  "express": "4.13.4",
  "express-graphql": "^0.5.3",
  "graphql": "0.4.18",
  "graphql-relay": "0.3.6",
  "mongodb": "2.0.39",
  "q": "1.4.1"
  },
  "devDependencies": {
  "babel": "^5.8.3",
  "babel-core": "^5.8.3",
  "babel-eslint": "^4.0.5",
  "babelify": "^6.1.1",
  "babel-cli": "^6.8.0",
  "babel-jest": "^12.0.2",
  "babel-plugin-transform-runtime": "^6.8.0",
  "babel-polyfill": "^6.8.0",
  "eslint": "^0.24.0",
  "eslint-plugin-react": "^3.2.2",
  "flow-bin": "^0.22.1"
  },
  </code></pre>
  
  <p>Yet still, its as if Babel is not being triggered? Or doesn't know how to read this kind of Javascript? What would cause this error? </p>