title: How to fix 'Error: Cannot find module 'supertest''
body: <p>I am new to nodejs. I got one nodejs application and i was just trying to run the tests this app contains. So i tried to run npm test command after installing all packages using npm install. But npm test is throwing below error always</p>
  
  <pre><code>internal/modules/cjs/loader.js:657
      throw err;
      ^
  
  Error: Cannot find module 'supertest'
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:655:15)
      at Function.Module._load (internal/modules/cjs/loader.js:580:25)
      at Module.require (internal/modules/cjs/loader.js:711:19)
      at require (internal/modules/cjs/helpers.js:14:16)
  </code></pre>
  
  <p>I tried to uninstall and install supertest but it did not help. I see there is no node_modules folder inside supertest. Would that be an issue? How do we fix it?</p>
  
  <p>Here is the file which is using supertest</p>
  
  <pre><code>var fs = require('fs')
  var request = require('supertest')
  
  var config = require('./config').getConfig()
  var url = config.url
  
  var caCert
  if (config.caCertFile) {
    caCert = fs.readFileSync(config.caCertFile)
  }
  
  var preparedRequest = function () {
    return caCert ? request.agent(url, { ca: caCert }) : request(url)
  }
  
  module.exports = preparedRequest
  </code></pre>