title: Error: Cannot find module 'config' at Function.Module._resolveFilename
body: <p>Hii I have simple node server, with the following structure</p>
  
  <pre><code>myapp
   -config 
      -default-json
   -index.js
   -package-lock.json
   -package.json
  </code></pre>
  
  <p>Here is my part of my index.js </p>
  
  <pre><code>'use strict';
  
  const
      config = require('config'),
      express = require('express'),
      request = require('request'),
      body_parser = require('body-parser'),
      app = express().use(body_parser.json()); // creates express http server
  
  // Sets server port and logs message on success
  app.listen(process.env.PORT || 1337, () =&gt; console.log('webhook is listening'));
  </code></pre>
  
  <p>when I run node index.js I get the following error</p>
  
  <pre><code>internal/modules/cjs/loader.js:583
      throw err;
      ^
  
  Error: Cannot find module 'config'
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
      at Function.Module._load (internal/modules/cjs/loader.js:507:25)
      at Module.require (internal/modules/cjs/loader.js:637:17)
      at require (internal/modules/cjs/helpers.js:22:18)
      at Object.&lt;anonymous&gt; (C:\xampp\htdocs\chat\index.js:13:14)
      at Module._compile (internal/modules/cjs/loader.js:689:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
      at Module.load (internal/modules/cjs/loader.js:599:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
      at Function.Module._load (internal/modules/cjs/loader.js:530:3)
  </code></pre>
  
  <p>what is wrong with my code?</p>