title: Got _socket2.default is not a function when using babel-node
body: <p>I am studying Full-Stack Redux on the following page: <a href="http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html#introducing-the-redux-store" rel="nofollow noreferrer">http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html#introducing-the-redux-store</a></p>
  <p>After created new server using socket-io in server.js and run app using babel-node, I got the following error:</p>
  <blockquote>
  <p>/home/ubuntu/workspace/src/server.js:15</p>
  <pre><code>var io = new _socket2.default().attach(8090);
           ^
  </code></pre>
  <p>TypeError: _socket2.default is not a function</p>
  <pre><code>at startServer (server.js:4:16)
  at Object.&lt;anonymous&gt; (index.js:5:1)
  at Module._compile (module.js:409:26)
  at loader (/home/ubuntu/workspace/node_modules/babel-cli/node_modules/babel-register/lib/node.js:126:5)
  at Object.require.extensions.(anonymous function) [as .js] (/home/ubuntu/workspace/node_modules/babel-cli/node_modules/babel-register/lib/node.js:136:7)
  at Module.load (module.js:343:32)
  at Function.Module._load (module.js:300:12)
  at Function.Module.runMain (module.js:441:10)
  at /home/ubuntu/workspace/node_modules/babel-cli/lib/_babel-node.js:161:27
  at Object.&lt;anonymous&gt; (/home/ubuntu/workspace/node_modules/babel-cli/lib/_babel-node.js:162:7)
  </code></pre>
  </blockquote>
  <p>This is the code of server.js</p>
  <pre><code>import Server from 'socket.io';
  
  export default function startServer() {
      const io = new Server().attach(8090);
  };
  </code></pre>
  <p>This is the code of index.js</p>
  <pre><code>import makeStore from './src/store';
  import startServer from './src/server';
  
  export const store = makeStore();
  startServer();
  </code></pre>
  <p>and this is package.json file:</p>
  <pre><code>{
    &quot;name&quot;: &quot;chat-example&quot;,
    &quot;version&quot;: &quot;0.0.0&quot;,
    &quot;description&quot;: &quot;A chat example to showcase how to use `socket.io` with a static `express` server with `async` for control flow.&quot;,
    &quot;main&quot;: &quot;server.js&quot;,
    &quot;repository&quot;: &quot;&quot;,
    &quot;author&quot;: &quot;Mostafa Eweda &lt;mo.eweda@gmail.com&gt;&quot;,
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;babel-node index&quot;,
      &quot;test&quot;: &quot;mocha --compilers js:babel-core/register --require ./test/test_helper.js --recursive&quot;,
      &quot;test:watch&quot;: &quot;npm run test -- --watch&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;babel-cli&quot;: &quot;^6.6.5&quot;,
      &quot;babel-core&quot;: &quot;^6.7.2&quot;,
      &quot;babel-preset-es2015&quot;: &quot;^6.6.0&quot;,
      &quot;chai&quot;: &quot;^3.5.0&quot;,
      &quot;chai-immutable&quot;: &quot;^1.5.3&quot;,
      &quot;mocha&quot;: &quot;^2.4.5&quot;
    },
    &quot;babel&quot;: {
      &quot;presets&quot;: [
        &quot;es2015&quot;
      ]
    },
    &quot;dependencies&quot;: {
      &quot;async&quot;: &quot;~0.2.8&quot;,
      &quot;express&quot;: &quot;~3.2.4&quot;,
      &quot;immutable&quot;: &quot;^3.7.6&quot;,
      &quot;redux&quot;: &quot;^3.3.1&quot;,
      &quot;socket.io&quot;: &quot;^0.9.17&quot;
    }
  </code></pre>
  <p>I did exactly the same as what was written on the page. Please give me suggestions on this case. Thanks</p>