title: Node module with Helper file results in 'cannot find module' error when installed
body: <p>Apologies in advance, I'm sure there's a simple answer in an obvious thread I've just failed to find it/understand it.</p>
  
  <p>Given a node.js module <code>Jimmy</code> implemented in the global <code>node_modules/Jimmy/index.js</code> file; I have a few 'helper' functions that I put in a separate <code>Helper.js</code> file, all in the same directory. Works great when I run a sample program <code>require</code>ing it from the same directory, but running that same sample program from anywhere else, it fails to load the supporting Helper.js file:</p>
  
  <pre><code>    Error: Cannot find module 'Helper'
  </code></pre>
  
  <p>Can someone explain or point me to an explanation of why this doesn't work and what I should be doing to make it work?</p>
  
  <p>Edit: Dumbed it down to just demo the problem. Including the Swagger-client dependency just in case that matters.</p>
  
  <p>Node Module is called Jimmy in the directory <code>~/Jimmy</code>.</p>
  
  <p>Module class defined in <code>~/Jimmy/index.js</code>:</p>
  
  <pre><code>var Swagger = require('swagger-client');
  var Helper  = require('Helper');
  function Jimmy (host, username, password) {
      this._host = host;
      this._hdr = {
          'Authorization': 'Basic ' + new     Buffer(username+':'+password).toString('base64') ,
          'Content-Type': 'application/json'
      };
  }
  Jimmy.prototype.getEntity = function(entity) {
      return Helper.get(this._host, this._hdr, entity);
  }
  module.exports =
  {
      Jimmy: Jimmy
  };
  </code></pre>
  
  <p>Module helper function defined in <code>~/Jimmy/Helper.js</code>:</p>
  
  <pre><code>var Swagger = require('swagger-client');
  function get(host, hdr, entity) {
      var url = 'http://'+host+'/config/' + entity;
      var request = {
          url    : url,
          headers: hdr
      };
      return Swagger.http(request)
          .then( (res) =&gt; { return res.body; });
  }
  module.exports =
  {
      get : get
  };
  </code></pre>
  
  <p>And sample test in <code>~/test.js</code>:</p>
  
  <pre><code>var jimmy = require('Jimmy');
  var j = new jimmy.Jimmy('192.168.56.151:8080', 'admin', 'admin');
  j.getEntity('joey')
      .then( (e) =&gt; {
          console.log(JSON.stringify(e, null, 2));
      })
      .catch( (err) =&gt; { console.log('ERR: ' + err); });
  </code></pre>