title: Node JS: net.Socket is not a constructor
body: <p>The below code works fine if I run it from my command line, but if I run this code anywhere in my project I get this error:</p>
  
  <pre><code>net.Socket is not a constructor
  </code></pre>
  
  <p>I've tried making the below code an object and importing / requiring it into my project and I still get that error.</p>
  
  <pre><code>var net = require('net');
  
  var client = new net.Socket();
      client.connect(3000, '127.0.0.1', function() {
      console.log('Connected');
      client.write('Hello, server! Love, Client.');
  });
  </code></pre>
  
  <p>Am I miss understanding what require does, I also tried using <code>import</code> and <code>import * as</code> to obtain 'net'.  </p>
  
  <p>I'm not too sure what information would be useful in the situation. Any suggestions would be great.</p>