title: NodeJs : TypeError: require(...) is not a function
body: <p>I am trying to require a file and afterwards pass it to a var. I am following <a href="https://scotch.io/tutorials/easy-node-authentication-setup-and-local" rel="noreferrer">this</a> tutorial to create an authentication system. After writing the server.js file and trying to compile I got a BSON error therefore I changed the line that required the release version of it in mongoose.</p>
  <p>Here are my code and error:</p>
  <p><em><strong>server.js</strong></em></p>
  <pre><code>require('./app/routes')(app, passport);
  </code></pre>
  <p><em><strong>Error</strong></em></p>
  <pre><code>require('./app/routes')(app, passport);
                     ^
  
  TypeError: require(...) is not a function
             at Object.&lt;anonymous&gt; (d:\Node JS learning\WorkWarV2\server.js:38:24)
             at Module._compile (module.js:434:26)
             at Object.Module._extensions..js (module.js:452:10)
             at Module.load (module.js:355:32)
             at Function.Module._load (module.js:310:12)
             at Function.Module.runMain (module.js:475:10)
             at startup (node.js:117:18)
             at node.js:951:3
  
  Process finished with exit code 1
  </code></pre>
  <p>I have read that this usually means that <code>requireJS</code> is not getting loaded properly yet I am not aware why or how to fix it.</p>
  <p><em><strong>Edit due to comment:</strong></em></p>
  <p>As asked, <a href="http://paste.isomorphis.me/vj3" rel="noreferrer">here</a> is the result of <code>console.log(require);</code></p>