title: NodeJS Sub-Modules
body: <p>I've a node application and want to extract some code in sub modules (simple node modules with own dependencies). For now, I don't want separate <code>git</code> repositories or <code>npm registry entries</code> for that, but just provide them in subdirectories.</p>
  
  <p>One of these modules is named <code>core</code>, because it should be used in the main node application as well as in other sub modules.</p>
  
  <p>Let's say this is my structure:</p>
  
  <blockquote>
    <ul>
    <li>myProject
    
    <ul>
    <li>package.json</li>
    <li>app.js</li>
    <li>core
    
    <ul>
    <li>index.js</li>
    <li>package.json</li>
    </ul></li>
    <li>partner
    
    <ul>
    <li>index.js</li>
    <li>package.json</li>
    </ul></li>
    </ul></li>
    </ul>
  </blockquote>
  
  <p>partner needs core and <code>app.js</code> needs core as well. My approach was to do the following:</p>
  
  <pre><code>cd partner
  npm install --save ../core
  cd ..
  npm install --save ./core
  npm install --save ./partner
  npm install
  </code></pre>
  
  <p>which errored in:</p>
  
  <blockquote>
    <p>npm ERR! code ENOENT</p>
    
    <p>npm ERR! errno -2</p>
    
    <p>npm ERR! syscall rename</p>
    
    <p>npm ERR! enoent ENOENT: no such file or directory, rename '/home/tjorben/dev/myProject/node_modules/.staging/sliced-fc0a1515' -> '/home/tjorben/dev/myProject/core/node_modules/mquery/node_modules/sliced'</p>
  </blockquote>
  
  <p>My goal ist, that I just have to make an npm install on the base folder (<code>myProject</code>) and it installs the dependencies for <code>core</code> and <code>partner</code> as well. Is there any way to achieve this?</p>