title: NodeJS throws module_not_found
body: <p>When I'm importing modules using require, it throws a MODULE_NOT_FOUND error.
  (mymain.js)</p>
  
  <pre><code>var counter = require(".\count");
  var array=[10,20,30];
  console.log(counter(array));
  
  </code></pre>
  
  <p>Here is the module that I'm trying to import(count.js)</p>
  
  <pre><code> var counter = function(arr){
      return 'length= '+arr.length;
  };
  module.exports = counter ;
  </code></pre>
  
  <p>Both of these codes are in the same directory.
  Node mymain throws the following error.</p>
  
  <pre><code>D:\Programming\NodeJS&gt;node mymain
  internal/modules/cjs/loader.js:1017
    throw err;
    ^
  
  Error: Cannot find module '.count'
  Require stack:
  - D:\Programming\NodeJS\mymain.js
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
      at Function.Module._load (internal/modules/cjs/loader.js:884:27)
      at Module.require (internal/modules/cjs/loader.js:1074:19)
      at require (internal/modules/cjs/helpers.js:72:18)
      at Object.&lt;anonymous&gt; (D:\Programming\NodeJS\mymain.js:1:15)
      at Module._compile (internal/modules/cjs/loader.js:1185:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
      at Module.load (internal/modules/cjs/loader.js:1034:32)
      at Function.Module._load (internal/modules/cjs/loader.js:923:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ 'D:\\Programming\\NodeJS\\mymain.js' ]
  }
  </code></pre>