<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">I've got a pre-workspaces monorepo setup like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=".
├── app1
│   └── package.json
├── app2
│   └── package.json
└── packages
    ├── pkg1
    │   └── package.json
    └── pkg2
        └── package.json
"><pre class="notranslate"><code class="notranslate">.
├── app1
│   └── package.json
├── app2
│   └── package.json
└── packages
    ├── pkg1
    │   └── package.json
    └── pkg2
        └── package.json

</code></pre></div>
<p dir="auto">In app1 and app2 we consume the shared packages like this:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
	&quot;dependencies&quot;: {
		&quot;@us/pkg1&quot;: &quot;file:./../packages/pkg1&quot;
	}
}"><pre class="notranslate">{
	<span class="pl-ent">"dependencies"</span>: {
		<span class="pl-ent">"@us/pkg1"</span>: <span class="pl-s"><span class="pl-pds">"</span>file:./../packages/pkg1<span class="pl-pds">"</span></span>
	}
}</pre></div>
<p dir="auto"><code class="notranslate">pkg1</code> has a set of external dependencies specified in its <code class="notranslate">package.json</code>, e.g.</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
	&quot;dependencies&quot;: {
		&quot;lodash&quot;: &quot;4.17.21&quot;
	}
}"><pre class="notranslate">{
	<span class="pl-ent">"dependencies"</span>: {
		<span class="pl-ent">"lodash"</span>: <span class="pl-s"><span class="pl-pds">"</span>4.17.21<span class="pl-pds">"</span></span>
	}
}</pre></div>
<p dir="auto">When I run <code class="notranslate">npm i</code> from within one of the app folders, the package itself gets installed, however starting with npm 7 (all versions I could test until now), the transient dependencies of the packages (lodash when following the example above) won't get installed, thus making the applications fail with import errors. When I manually install the transient dependencies by running <code class="notranslate">npm i</code> from within the package directory, it works as expected.</p>
<p dir="auto">The repo does not have a top level package.json and it does not configure workspaces anywhere.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">I would expect npm to not only install the linked local package, but also its dependencies. This happens with npm 6 but not with npm 7.</p>
<p dir="auto">Using <code class="notranslate">npm link</code> or installing does not make a difference.</p>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: Ubuntu 20.04</li>
<li>Node: 12.6.1</li>
<li>npm: 7.8.0</li>
</ul>
<h3 dir="auto">This might not be a bug?</h3>
<p dir="auto">I am aware that npm 7 brought the workspaces feature and this behavior might not be a bug but expected behavior as I am supposed to use workspaces for such a monorepo setup, however this would mean we'd need to migrate the entire team from npm 6 to 7 at the same point in time.</p>
<hr>
<p dir="auto">I created a reproducible example over here <a href="https://github.com/m90/npm-monorepo-issue">https://github.com/m90/npm-monorepo-issue</a></p>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">npm v7 does not install linked local packages dependencies.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">In npm v6 the dependencies of a local linked package are installed. This means that if <code class="notranslate">app</code> has <code class="notranslate">my-local-pkg</code> as a dependency, running <code class="notranslate">npm install</code> generates <code class="notranslate">app/node_modules</code> folder and also <code class="notranslate">my-local-pkg/node_modules</code> (with its dependencies).<br>
In npm v7, however, only <code class="notranslate">app/node_modules</code> is generated.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<p dir="auto">I created the <a href="https://github.com/garciaalvaro/npm-deps-issue">following repository</a> to illustrate it. The <code class="notranslate">README.md</code> has the instructions on how to reproduce it.<br>
Simplified, the steps are:</p>
<ol dir="auto">
<li>Add the following folder structure: <code class="notranslate">./app</code> and <code class="notranslate">./my-local-pkg</code>, each with their own <code class="notranslate">package.json</code></li>
<li>Include this in the <code class="notranslate">./app/package.json</code>:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;app&quot;,
  &quot;dependencies&quot;: {
    &quot;my-local-pkg&quot;: &quot;file:../my-local-pkg&quot;,
    &quot;prettier&quot;: &quot;^2.2.1&quot;
  }
}"><pre class="notranslate"><code class="notranslate">{
  "name": "app",
  "dependencies": {
    "my-local-pkg": "file:../my-local-pkg",
    "prettier": "^2.2.1"
  }
}
</code></pre></div>
<ol start="3" dir="auto">
<li>Include this in the <code class="notranslate">./my-local-pkg/package.json</code>:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;my-local-pkg&quot;,
  &quot;dependencies&quot;: {
    &quot;typescript&quot;: &quot;^4.1.3&quot;
  }
}"><pre class="notranslate"><code class="notranslate">{
  "name": "my-local-pkg",
  "dependencies": {
    "typescript": "^4.1.3"
  }
}
</code></pre></div>
<ol start="4" dir="auto">
<li>Go to <code class="notranslate">./app</code> and run <code class="notranslate">npm install</code>.<br>
npm version 6 produces:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="node_modules
	.bin
	my-local-pkg
		node_modules
			typescript
	prettier"><pre class="notranslate"><code class="notranslate">node_modules
	.bin
	my-local-pkg
		node_modules
			typescript
	prettier
</code></pre></div>
<p dir="auto">while npm version 7 produces:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="node_modules
	.bin
	my-local-pkg
	prettier"><pre class="notranslate"><code class="notranslate">node_modules
	.bin
	my-local-pkg
	prettier
</code></pre></div>
<p dir="auto">Compare the two outputs, npm v7 does not install <code class="notranslate">my-local-pkg</code> dependencies, there is no <code class="notranslate">./my-local-pkg/node_modules</code> folder generated.</p>
<h3 dir="auto">Environment:</h3>
<p dir="auto">npm v7.1.2</p>