title: Cannot read property 'connect' of undefined. dependency is installed
body: <p>I have used port 27017 for a different project. The terminal with the port is up and running, and I can connect it to robo 3t to prove it. </p>
  
  <p>When i open another terminal and run mongoDB, it also works. I have it installed as a dependency and is in my package.json file showing the version. </p>
  
  <p>When I use the code below to connect to mongoDB I am getting the errors that follow. It seems that mongoDB wasn't installed, but I do not understand how that can be. </p>
  
  <p>Any ideas as to why this won't work? Thanks.</p>
  
  <p>my code:</p>
  
  <pre><code>const {MongoClient} = require('mongodb').MongoClient;
  
  MongoClient.connect('mongodb://localhost:27017/HEALTH', (err, client) =&gt; {
   if (err) {
   return console.log('Unable to connect to MongoDB server');
   }
    console.log('Connected to MongoDB server');
  
   client.close();
    });
  </code></pre>
  
  <p>the error BASH is giving me:</p>
  
  <pre><code> $ node server/server.js
      C:\Users\shail\Desktop\HEALTH\server\server.js:3
     MongoClient.connect('mongodb://localhost:27017/HEALTH', (err, client) =&gt; {
          ^
  
     TypeError: Cannot read property 'connect' of undefined
  </code></pre>