<h3 dir="auto">Current Behavior:</h3>
<p dir="auto"><code class="notranslate">npm install &lt;pkg&gt;</code> runs pre and post install scripts specified in <code class="notranslate">&lt;pkg&gt;</code>.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">Either pre and post install scripts must not run or this should be explicitly documented in the npm-install page. Also documentation on npm-scripts page is confusing with it stating that lifecycle scripts are run on <code class="notranslate">npm install</code> and <code class="notranslate">npm install -g &lt;pkg&gt;</code> (no mention of <code class="notranslate">npm install &lt;pkg&gt;</code>)</p>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: Windows 10 x64</li>
<li>Node: 14.15.4</li>
<li>npm: 7.6.3</li>
</ul>
<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto"><a href="https://github.com/npm/cli/files/6631599/tst.zip">tst.zip</a></p>
<p dir="auto">first just do</p>
<p dir="auto">npm install</p>
<p dir="auto">on the root dir</p>
<p dir="auto">if you look then in node_modules you don't have an 'uppy' or  'uppy-angular' or '<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/biacsics/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/biacsics">@biacsics</a>' (thats good)</p>
<p dir="auto">the try</p>
<p dir="auto">npm install ./child</p>
<p dir="auto">npm ERR! code ERESOLVE<br>
npm ERR! ERESOLVE unable to resolve dependency tree<br>
npm ERR!<br>
npm ERR! Found: @angular/common@7.2.16<br>
npm ERR! child/node_modules/@angular/common<br>
npm ERR!   peer @angular/common@"^7.2.0" from uppy-angular@0.1.4<br>
npm ERR!   child/node_modules/uppy-angular<br>
npm ERR!     uppy-angular@"^0.1.4" from @servoy/servoyextracomponents@4.1.0<br>
npm ERR!     child<br>
npm ERR!       @servoy/servoyextracomponents@4.1.0<br>
npm ERR!       node_modules/@servoy/servoyextracomponents<br>
npm ERR!         @servoy/servoyextracomponents@"file:child" from the root project<br>
npm ERR!<br>
npm ERR! Could not resolve dependency:<br>
npm ERR! peer @angular/common@"&gt;=9.0.0" from @biacsics/ng-canvas-gauges@6.0.7<br>
npm ERR! child/node_modules/@biacsics/ng-canvas-gauges<br>
npm ERR!   @biacsics/ng-canvas-gauges@"^6.0.7" from @servoy/servoyextracomponents@4.1.0<br>
npm ERR!   child<br>
npm ERR!     @servoy/servoyextracomponents@4.1.0<br>
npm ERR!     node_modules/@servoy/servoyextracomponents<br>
npm ERR!       @servoy/servoyextracomponents@"file:child" from the root project<br>
npm ERR!</p>
<p dir="auto">so it wants to have an angular/<a href="mailto:common@7.x">common@7.x</a> (from the uppy lib)</p>
<p dir="auto">i am not sure why it also reports then @biacsics/ng-canvas-gauges becaus ethat is a &gt;=9.0 and that should be fine thats not the problem<br>
the problem i guess is the root angular itself which is fixed to 12.0.3 (i kind of expect that error the be seen)</p>
<p dir="auto">if you do then</p>
<p dir="auto">npm install ./child --force</p>
<p dir="auto">now in the root module you do have an "uppy" and "<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/UPPY/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/UPPY">@UPPY</a>" suddenly there but not the rest what i expect to also have installed there</p>
<p dir="auto">but if i look into the child i see a node_modules then i see there suddenly <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/biacsics/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/biacsics">@biacsics</a> and uppy-angular why are these 2 there but the other depedencies of those are in the root?</p>
<p dir="auto">but that is not the the biggest problem</p>
<p dir="auto">in the childs/node_modules you also see an <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/angular/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/angular">@angular</a>\core and <a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/angular/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/angular">@angular</a>\common<br>
and you kind of expect that because of the error above and because of the --force those are version 7.2.16<br>
but no, what is in there is suddenly the latest angular thats at this time 12.0.4 (root has 12.0.3)</p>
<p dir="auto">why does that happen in force mode?<br>
What i want is that nothing of angular is installed (not a newer or a older version). But i would conceptually understand better if an older version was installed...</p>
<p dir="auto">but only when i use instead of --force:</p>
<p dir="auto">npm install .\child --legacy-peer-deps</p>
<p dir="auto">then everything is working as i expect</p>
<p dir="auto">everything is installed into the root node_modules and no duplicate peers are installed.</p>
<p dir="auto">So these scenario's which will happen constantly because of all the npm packages that are out there that are not always actively maintained which can have peer depedencies pointing to older stuff<br>
will only be able to work if you use --legacy-peer-deps?<br>
But the name "legacy" means its something that will be depricated, shouldn't be used..<br>
But its kind of crucial to work with a lot of packages. or i have to form them all and make sure to update all the peers constantly...</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">the expected behavior is kind of the  --legacy-peer-deps<br>
thats how i want it to work or need it to work<br>
For me it can never install 2 angulars because that will cause many problems in angular apps</p>
<p dir="auto">But i guess you could say that at least the expected behavior that it would have installed angular 7.x not the latest 12.x</p>
<p dir="auto">But that wouldn't really give me the solution i want, and that is that it never installs a conflicting peer dependency, if there is one the main package.json file is always leading</p>
<h3 dir="auto">Steps To Reproduce</h3>
<p dir="auto">see the above steps and the attached zip.</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: Windows 10</li>
<li>Node: v16.2.0</li>
<li>npm: 7.16.0</li>
</ul>