title: How do I get my NPM module to install its dependencies correctly?
body: <p>I'm having problems with my home-rolled NPM module as when installed it installs most of it's dependencies in the applications node_modules directory, instead of containing it inside the module itself.</p>
  
  <p>Ex;</p>
  
  <pre><code>APP
      node_modules
          MY_MODULE
              node_modules
                  &lt;ALL deps from MY_MODULE should be installed here&gt;
          &lt;SOME/MOST deps from MY_MODULE are installed here&gt;
  </code></pre>
  
  <p>The above causes issues because I have dependencies that require a specific version that's installed under MY_MODULE/node_modules and NOT under MY_APP/node_modules.</p>
  
  <p>For instance; I have Webpack 3 installed under APP/node_modules but MY_MODULE requires Webpack 4 and that is installed under MY_MODULE/node_modules as you would expect.
  But everything else, that requires Webpack 4, is installed under APP/node_modules and thus gives an error message.</p>
  
  <p>So, in the app I have a package.json:
  devDependencies: "webpack": "^3.12.0",</p>
  
  <p>And in my NPM module I have a package.json:
  "dependecies": [
  "webpack": "^4.12.0",
  "webpack-cli": "^3.0.8",
  ]</p>
  
  <p>webpack-cli is installed under APP/node_modules and thus complains that it requires Webpack 4 and that it couldn't be found.</p>
  
  <p>if webpack-cli instead installed itself under APP / node_modules / MY_MODULE / node_modules it would work.</p>
  
  <p>How can I get it to do that?</p>
  
  <p>Thanks,</p>
  
  <p>/J</p>