title: NodeJS require issue
body: <p>I have nodeJS express setup having the following structure -</p>
  <pre><code>-app.js
  -routes
  ---user_router.js
  ---org_router.js
  -controller
  ---user.js
  ---organization.js
  -model
  ---userOrganization.js
  </code></pre>
  <p>Now, my <code>app.js</code> has the routes declarations one after another, and in my both routes their specific controller's get() methods are called</p>
  <p><strong>app.js</strong></p>
  <pre><code>const express = require('express');
  // ---- Some required code ----
  
  const user_router = require('./routes/user_router');
  const org_router = require('./routes/org_router');
  
  app.use('/user_router', user_router);
  app.use('/org_router', org_router);
  
  // ---- Some required code ----
  </code></pre>
  <p><strong>Routes</strong></p>
  <blockquote>
  <p>user_router.js</p>
  </blockquote>
  <pre><code>const express = require('express');
  const userCtrl = require('../../controllers/user');
  const router = express.Router();
  
  router.get('/getUser', (req, res) =&gt; {
      userCtrl.getUsers()
        .then((result) =&gt; {
          res.json(result);
        })
        .catch((error) =&gt; {
          res.status(500).send({ message: 'Error' });
        });
  });
  module.exports = router;
  </code></pre>
  <blockquote>
  <p>org_router.js</p>
  </blockquote>
  <pre><code>const express = require('express');
  const orgCtrl = require('../../controllers/organization');
  const router = express.Router();
  
  router.get('/getOrg', (req, res) =&gt; {
    orgCtrl.getOrg()
        .then((result) =&gt; {
          res.json(result);
        })
        .catch((error) =&gt; {
          res.status(500).send({ message: 'Error' });
        });
  });
  module.exports = router;
  </code></pre>
  <p><strong>Controllers</strong></p>
  <blockquote>
  <p>user</p>
  </blockquote>
  <pre><code>const userOrganizations = require('../models/userOrganizations.js');
  const getUsers = () =&gt; new Promise((resolve, reject) =&gt; {
      userOrganizations.getOrgWiseUser()
      .then(resolve)
      .catch(reject);
  });
  
  module.exports = {
    getUsers,
  };
  </code></pre>
  <blockquote>
  <p>Organizations</p>
  </blockquote>
  <pre><code>const userOrganizations = require('../models/userOrganizations.js');
  const getOrg = () =&gt; new Promise((resolve, reject) =&gt; {
      userOrganizations.getUserWiseOrg()
      .then(resolve)
      .catch(reject);
  });
  
  module.exports = {
    getOrg,
  };
  </code></pre>
  <p><strong>Models</strong></p>
  <blockquote>
  <p>userOrganizations</p>
  </blockquote>
  <pre><code>const getUsers = () =&gt; new Promise((resolve, reject) =&gt; {
      resolve(['testUser1', 'testUser2', 'testUser3']);
  });
  
  const getOrg = () =&gt; new Promise((resolve, reject) =&gt; {
    resolve(['testOrg1', 'testOrg2', 'testOrg3']);
  });
  
  module.exports = {
    getUsers,
    getOrg,
  };
  </code></pre>
  <p>Now, there is plenty of other code resides in my repo including routes, controller, models, and all others, etc.
  Now when I call the specific method of <code>org_router</code> I am facing the error -</p>
  <blockquote>
  <p>userOrganizations.getUserWiseOrg is not a function</p>
  </blockquote>
  <p>If I rewrite controller <code>organization.js</code> like below then it is working(Just moving model declaration from global to local in function)</p>
  <pre><code>const getOrg = () =&gt; new Promise((resolve, reject) =&gt; {
    const userOrganizations = require('../models/userOrganizations.js');
    userOrganizations.getUserWiseOrg()
    .then(resolve)
    .catch(reject);
  });
  </code></pre>
  <p>I am not understanding why it is not allowing me to declare the model globally(Why the globally required package is not accessible)</p>
  <p>There is one more case if I comment out the <code>require()</code> statement from the <code>user</code> Controller then my <code>organization</code> controller's global require() statement works well and also it is accessible inside the function as well.</p>
  <p>My node version is - <code>v12.20.0</code></p>
  <p>What can be the issue? any guess????</p>