<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">This issue exists in the latest npm version</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I am using the latest npm</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">I'm using <code class="notranslate">npm@8.5.2</code> and making use of the workspaces feature, my (simplified) project's structure is the following:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="my_project
|_ packages
   |_ commons
   |_ logger
   |_ metrics
   |_ tracing
package.json "><pre class="notranslate">my_project
<span class="pl-k">|</span>_ packages
   <span class="pl-k">|</span>_ commons
   <span class="pl-k">|</span>_ logger
   <span class="pl-k">|</span>_ metrics
   <span class="pl-k">|</span>_ tracing
package.json </pre></div>
<p dir="auto">In my <code class="notranslate">package.json</code> file I have the following config:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;workspaces&quot;: [
    &quot;packages/*&quot;
 ]"><pre class="notranslate"><span class="pl-ent">"workspaces"</span>: [
    <span class="pl-s"><span class="pl-pds">"</span>packages/*<span class="pl-pds">"</span></span>
 ]</pre></div>
<p dir="auto">The project uses TypeScript and the packages <code class="notranslate">logger</code>, <code class="notranslate">metrics</code>, <code class="notranslate">tracing</code> all depend on <code class="notranslate">commons</code>.</p>
<p dir="auto">When I run <code class="notranslate">npm ci</code> in my CI/CD environment (GitHub Actions) after installing the dependencies npm tries to build (<code class="notranslate">tsc</code>) the packages but appear to do so in parallel and so the build of all the dependant packages fails because it's being done before <code class="notranslate">commons</code> is ready.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Npm to understand that some packages of the workspace are dependant on others and build accordingly.</p>
<p dir="auto">Alternatively to allow me to specify that I want to use a remote (i.e. not linked) version of the package even though the version number is the same as the local one.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<p dir="auto">Read above, also you can see the error (with <code class="notranslate">logLevel == silly</code>) here <a href="https://github.com/dreamorosi/aws-lambda-powertools-typescript/runs/5345787297?check_suite_focus=true#step:6:5380">https://github.com/dreamorosi/aws-lambda-powertools-typescript/runs/5345787297?check_suite_focus=true#step:6:5380</a> (&lt;- Line that causes the error)</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.5.2</li>
<li>Node.js: lts/fermium (aka 14.x)</li>
<li>OS Name: Ubuntu</li>
<li>System Model Name: GitHub Actions</li>
<li>npm config: N/A</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">This issue exists in the latest npm version</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I am using the latest npm</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto"><code class="notranslate">npm i</code> runs Prepare script concurrently across all workspaces.</p>
<p dir="auto">This causes <strong>major</strong> problems when using TypeScript and having one workspace dependent on another, since the build (prepare script) runs concurrently, there is no way to ensure the prepare command is done on one workspace before running on the next.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">It to <strong>actually</strong> follow what the documentation says (<a href="https://docs.npmjs.com/cli/v7/using-npm/workspaces#running-commands-in-the-context-of-workspaces" rel="nofollow">https://docs.npmjs.com/cli/v7/using-npm/workspaces#running-commands-in-the-context-of-workspaces</a>):</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/860375/143791673-95e0e9ed-e268-493b-a5b5-6c7b94064b0e.png"><img width="686" alt="Screen Shot 2021-11-28 at 5 01 30 PM" src="https://user-images.githubusercontent.com/860375/143791673-95e0e9ed-e268-493b-a5b5-6c7b94064b0e.png" style="max-width: 100%;"></a></p>
<p dir="auto">Nothing in there says anything about commands being run concurrently, or at the same time.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Create 2 workspaces</li>
<li>Add a prepare command to each where the second is reliant on the first completing</li>
<li>Run <code class="notranslate">npm i</code></li>
<li>Notice that everything fails since the commands are run concurrently</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.1.0</li>
<li>Node: v16.13.0</li>
<li>OS: macOS 12.1 Beta (21C5039b)</li>
<li>platform: MacBook Pro M1 Max</li>
<li>npm config:</li>
</ul>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; &quot;user&quot; config from /Users/charliefish/.npmrc

//npm.pkg.github.com/:_authToken = (protected)
//registry.npmjs.com/:_authToken = (protected)
registry = &quot;https://npm.network.charlie.fish/&quot;

; node bin location = /Users/charliefish/.nvm/versions/node/v16.13.0/bin/node
; cwd = /Users/charliefish
; HOME = /Users/charliefish
; Run `npm config ls -l` to show all defaults."><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "user" config from /Users/charliefish/.npmrc</span>

//npm.pkg.github.com/:<span class="pl-k">_authToken</span> = (protected)
//registry.npmjs.com/:<span class="pl-k">_authToken</span> = (protected)
<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>https://npm.network.charlie.fish/<span class="pl-pds">"</span></span>

<span class="pl-c"><span class="pl-c">;</span> node bin location = /Users/charliefish/.nvm/versions/node/v16.13.0/bin/node</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = /Users/charliefish</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = /Users/charliefish</span>
<span class="pl-c"><span class="pl-c">;</span> Run `npm config ls -l` to show all defaults.</span></pre></div>