title: NodeJS | module.js:540 throw err
body: <p>So it's the first ever program I write but when I run it in the console I get this error.</p>
  
  <pre><code>module.js:540
      throw err;
      ^
  
  Error: Cannot find module 'C:\Users\Daniel\Desktop\app'
      at Function.Module._resolveFilename (module.js:538:15)
      at Function.Module._load (module.js:468:25)
      at Function.Module.runMain (module.js:684:10)
      at startup (bootstrap_node.js:187:16)
      at bootstrap_node.js:608:3
  </code></pre>
  
  <p>I have no idea why this is happening as I am new but I checked the code and nothing is wrong.</p>
  
  <pre><code>const http = require('http');
  
  const hostname = '127.0.0.1';
  const port = 3000;
  
  const server = http.createServer((req, res) =&gt; {
      res.statusCode = 200;
      res.setHeader('Content-type', 'text/plain');
      res.end('Hello World!');
  });
  
  server.listen(port, hostname, () =&gt; {
      console.log('Server started on port '+port);
  });
  </code></pre>