title: Unexpected token ) at createScript (vm.js:56:10) Node js when running gulp dev only on windows
body: <pre><code>SyntaxError: Unexpected token )
  at createScript (vm.js:56:10)
  at Object.runInThisContext (vm.js:97:10)
  at Module._compile (module.js:542:28)
  at Object.Module._extensions..js (module.js:579:10)
  at Module.load (module.js:487:32)
  at tryModuleLoad (module.js:446:12)
  at Function.Module._load (module.js:438:3)
  at Module.require (module.js:497:17)
  at require (internal/module.js:20:19)
  at Object.&lt;anonymous&gt; (C:\server\index.js:2:13)
  </code></pre>
  
  <p>I am getting this error when i run gulp dev 
  This happens only on windows , it is running fine in linux and the server is getting started on linux</p>
  
  <p>Below is the Snippet</p>
  
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const mongoose = require('mongoose');
  
  const routes = require('./routes');
  
  mongoose.connect('mongodb://localhost/testdb');
  const dbConnection = mongoose.connection;
  dbConnection.on(
      'error',
       console.error.bind(console, 'Connection Error:')
  );
  dbConnection.once(
      'open',
       () =&gt; {
           console.log('DB connection successful');
       }
  );
  </code></pre>
  
  <p>I get this error at 12th line ,</p>
  
  <p>However when i write it this way
  I won't get any error and server starts</p>
  
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const mongoose = require('mongoose');
  
  const routes = require('./routes');
  
  mongoose.connect('mongodb://localhost/ecommerce');
  const dbConnection = mongoose.connection;
  dbConnection.on('error', console.error.bind(console, 'Connection Error:'));
  dbConnection.once('open',()=&gt;{console.log('DB connection successful');});
  </code></pre>
  
  <p>What is the reason behind this ?</p>