title: Error: Cannot find Module '../utils/composeObjs' after installing generator-stencil globally
body: <p>I'm writing a generator for stenciljs at <a href="https://github.com/AkashGutha/generator-stencil" rel="nofollow noreferrer">https://github.com/AkashGutha/generator-stencil</a></p>
  
  <p>I have a small utility function sitting at the root of the project. It's just one file <code>utils/composeObjects.js</code> that exports one function <code>composeObjs</code>. I'm using this function in all the sub-generators in the generator. I'm using it in these place:</p>
  
  <ul>
  <li><code>app/index.js</code></li>
  <li><code>page/index.js</code></li>
  <li><code>component/index.js</code></li>
  </ul>
  
  <p>I'm testing my generator locally using <code>npm link</code> and then when i do <code>yo stencil</code> in a empty folder the generator works without any issue. </p>
  
  <p>However when i <code>npm publish</code> it and try to run <code>yo stencil</code> it throws the following error.</p>
  
  <pre><code>module.js:538
      throw err;
      ^
  
  Error: Cannot find module '../utils/composeObjects'
      at Function.Module._resolveFilename (module.js:536:15)
      at Function.Module._load (module.js:466:25)
      at Module.require (module.js:579:17)
      at require (internal/module.js:11:18)
      at Object.&lt;anonymous&gt; (/Users/Akash/.npm-global/lib/node_modules/generator-stencil/app/index.js:5:21)
      at Module._compile (module.js:635:30)
      at Object.Module._extensions..js (module.js:646:10)
      at Module.load (module.js:554:32)
      at tryModuleLoad (module.js:497:12)
      at Function.Module._load (module.js:489:3)
  </code></pre>
  
  <p>after searching i found out that require doesn't work as expected when a package is installed globally. But, i've looked at some other generators on github and some of them use some kind of util function and they work fine when installed globally.</p>
  
  <p>I'm also suspecting that this might be because the main module running is the main <code>yeoman</code>, because the <code>yo stencil</code> tells the <code>yeoman cli</code> to use that <code>generator</code>.</p>
  
  <p>I need to get rid of this error also would be niec to have some insight into what causes this module error.</p>
  
  <p>Here is the github issue: <a href="https://github.com/AkashGutha/generator-stencil/issues/1" rel="nofollow noreferrer">https://github.com/AkashGutha/generator-stencil/issues/1</a></p>