<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 have a mono-repo configuration with the following structure:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- packages
   |--- app
   |--- proxy
   |--- types"><pre class="notranslate"><code class="notranslate">- packages
   |--- app
   |--- proxy
   |--- types
</code></pre></div>
<p dir="auto">Both <code class="notranslate">proxy</code> &amp; <code class="notranslate">app</code> depends on <code class="notranslate">@nugit/types</code> (this is not the package in <code class="notranslate">packages/types</code> folder).</p>
<p dir="auto">The packages <code class="notranslate">@nugit/types</code> is installed twice in <code class="notranslate">packages/app</code> &amp; <code class="notranslate">packages/proxy</code>.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Package to be installed once in root node_modules.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<p dir="auto">This is a private repository, with private packages but here is an extract of my <code class="notranslate">package-lock.json</code></p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;nugit-app&quot;,
  &quot;version&quot;: &quot;0.1.0&quot;,
  &quot;lockfileVersion&quot;: 2,
  &quot;requires&quot;: true,
  &quot;packages&quot;: {
    &quot;packages/app&quot;: {
      &quot;name&quot;: &quot;nugit-app-fe&quot;,
      &quot;version&quot;: &quot;0.1.0&quot;,
      &quot;dependencies&quot;: {
        &quot;@nugit/env-service&quot;: &quot;^3.0.0&quot;,
        &quot;@nugit/time-service&quot;: &quot;^3.0.0&quot;,
        &quot;@nugit/types&quot;: &quot;^3.0.0&quot;
      },
      &quot;devDependencies&quot;: {},
      &quot;engines&quot;: {
        &quot;node&quot;: &quot;&gt;=14.18.0&quot;
      }
    },
    &quot;packages/app/node_modules/@nugit/types&quot;: {
      &quot;version&quot;: &quot;3.0.0&quot;,
      &quot;resolved&quot;: &quot;https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz&quot;,
      &quot;integrity&quot;: &quot;sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==&quot;,
      &quot;dependencies&quot;: {
        &quot;@babel/runtime&quot;: &quot;^7.17.7&quot;,
        &quot;core-js&quot;: &quot;^3.21.0&quot;
      },
      &quot;engines&quot;: {
        &quot;node&quot;: &quot;&gt;=14.18.0&quot;
      },
      &quot;peerDependencies&quot;: {
        &quot;react&quot;: &quot;^16.3.0 || ^17.0.2&quot;
      }
    },
    &quot;packages/proxy&quot;: {
      &quot;name&quot;: &quot;nugit-app-proxy&quot;,
      &quot;version&quot;: &quot;0.1.0&quot;,
      &quot;dependencies&quot;: {
        &quot;@nugit/env-service&quot;: &quot;^3.0.0&quot;,
        &quot;@nugit/logger-service&quot;: &quot;^3.0.0&quot;,
        &quot;@nugit/types&quot;: &quot;^3.0.0&quot;
      },
      &quot;devDependencies&quot;: {
      },
      &quot;engines&quot;: {
        &quot;node&quot;: &quot;&gt;=14.18.0&quot;
      }
    },
    &quot;packages/proxy/node_modules/@nugit/types&quot;: {
      &quot;version&quot;: &quot;3.0.0&quot;,
      &quot;resolved&quot;: &quot;https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz&quot;,
      &quot;integrity&quot;: &quot;sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==&quot;,
      &quot;dependencies&quot;: {
        &quot;@babel/runtime&quot;: &quot;^7.17.7&quot;,
        &quot;core-js&quot;: &quot;^3.21.0&quot;
      },
      &quot;engines&quot;: {
        &quot;node&quot;: &quot;&gt;=14.18.0&quot;
      },
      &quot;peerDependencies&quot;: {
        &quot;react&quot;: &quot;^16.3.0 || ^17.0.2&quot;
      }
    },
    &quot;dependencies&quot;: {
      &quot;nugit-app-fe&quot;: {
        &quot;@nugit/types&quot;: {
          &quot;version&quot;: &quot;3.0.0&quot;,
          &quot;resolved&quot;: &quot;https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz&quot;,
          &quot;integrity&quot;: &quot;sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==&quot;,
          &quot;requires&quot;: {
            &quot;@babel/runtime&quot;: &quot;^7.17.7&quot;,
            &quot;core-js&quot;: &quot;^3.21.0&quot;
          }
        }
      },
      &quot;nugit-app-proxy&quot;: {
        &quot;@nugit/types&quot;: {
          &quot;version&quot;: &quot;3.0.0&quot;,
          &quot;resolved&quot;: &quot;https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz&quot;,
          &quot;integrity&quot;: &quot;sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==&quot;,
          &quot;requires&quot;: {
            &quot;@babel/runtime&quot;: &quot;^7.17.7&quot;,
            &quot;core-js&quot;: &quot;^3.21.0&quot;
          }
        }
      }
    }
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>nugit-app<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>0.1.0<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"lockfileVersion"</span>: <span class="pl-c1">2</span>,
  <span class="pl-ent">"requires"</span>: <span class="pl-c1">true</span>,
  <span class="pl-ent">"packages"</span>: {
    <span class="pl-ent">"packages/app"</span>: {
      <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>nugit-app-fe<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>0.1.0<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"dependencies"</span>: {
        <span class="pl-ent">"@nugit/env-service"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.0.0<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"@nugit/time-service"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.0.0<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"@nugit/types"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.0.0<span class="pl-pds">"</span></span>
      },
      <span class="pl-ent">"devDependencies"</span>: {},
      <span class="pl-ent">"engines"</span>: {
        <span class="pl-ent">"node"</span>: <span class="pl-s"><span class="pl-pds">"</span>&gt;=14.18.0<span class="pl-pds">"</span></span>
      }
    },
    <span class="pl-ent">"packages/app/node_modules/@nugit/types"</span>: {
      <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.0.0<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"resolved"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"integrity"</span>: <span class="pl-s"><span class="pl-pds">"</span>sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"dependencies"</span>: {
        <span class="pl-ent">"@babel/runtime"</span>: <span class="pl-s"><span class="pl-pds">"</span>^7.17.7<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"core-js"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.21.0<span class="pl-pds">"</span></span>
      },
      <span class="pl-ent">"engines"</span>: {
        <span class="pl-ent">"node"</span>: <span class="pl-s"><span class="pl-pds">"</span>&gt;=14.18.0<span class="pl-pds">"</span></span>
      },
      <span class="pl-ent">"peerDependencies"</span>: {
        <span class="pl-ent">"react"</span>: <span class="pl-s"><span class="pl-pds">"</span>^16.3.0 || ^17.0.2<span class="pl-pds">"</span></span>
      }
    },
    <span class="pl-ent">"packages/proxy"</span>: {
      <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>nugit-app-proxy<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>0.1.0<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"dependencies"</span>: {
        <span class="pl-ent">"@nugit/env-service"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.0.0<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"@nugit/logger-service"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.0.0<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"@nugit/types"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.0.0<span class="pl-pds">"</span></span>
      },
      <span class="pl-ent">"devDependencies"</span>: {
      },
      <span class="pl-ent">"engines"</span>: {
        <span class="pl-ent">"node"</span>: <span class="pl-s"><span class="pl-pds">"</span>&gt;=14.18.0<span class="pl-pds">"</span></span>
      }
    },
    <span class="pl-ent">"packages/proxy/node_modules/@nugit/types"</span>: {
      <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.0.0<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"resolved"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"integrity"</span>: <span class="pl-s"><span class="pl-pds">"</span>sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==<span class="pl-pds">"</span></span>,
      <span class="pl-ent">"dependencies"</span>: {
        <span class="pl-ent">"@babel/runtime"</span>: <span class="pl-s"><span class="pl-pds">"</span>^7.17.7<span class="pl-pds">"</span></span>,
        <span class="pl-ent">"core-js"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.21.0<span class="pl-pds">"</span></span>
      },
      <span class="pl-ent">"engines"</span>: {
        <span class="pl-ent">"node"</span>: <span class="pl-s"><span class="pl-pds">"</span>&gt;=14.18.0<span class="pl-pds">"</span></span>
      },
      <span class="pl-ent">"peerDependencies"</span>: {
        <span class="pl-ent">"react"</span>: <span class="pl-s"><span class="pl-pds">"</span>^16.3.0 || ^17.0.2<span class="pl-pds">"</span></span>
      }
    },
    <span class="pl-ent">"dependencies"</span>: {
      <span class="pl-ent">"nugit-app-fe"</span>: {
        <span class="pl-ent">"@nugit/types"</span>: {
          <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.0.0<span class="pl-pds">"</span></span>,
          <span class="pl-ent">"resolved"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz<span class="pl-pds">"</span></span>,
          <span class="pl-ent">"integrity"</span>: <span class="pl-s"><span class="pl-pds">"</span>sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==<span class="pl-pds">"</span></span>,
          <span class="pl-ent">"requires"</span>: {
            <span class="pl-ent">"@babel/runtime"</span>: <span class="pl-s"><span class="pl-pds">"</span>^7.17.7<span class="pl-pds">"</span></span>,
            <span class="pl-ent">"core-js"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.21.0<span class="pl-pds">"</span></span>
          }
        }
      },
      <span class="pl-ent">"nugit-app-proxy"</span>: {
        <span class="pl-ent">"@nugit/types"</span>: {
          <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.0.0<span class="pl-pds">"</span></span>,
          <span class="pl-ent">"resolved"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://registry.npmjs.org/@nugit/types/-/types-3.0.0.tgz<span class="pl-pds">"</span></span>,
          <span class="pl-ent">"integrity"</span>: <span class="pl-s"><span class="pl-pds">"</span>sha512-HJORiTzwyJ+KjaT/PO2Cb9YBy13Uj5K6T3InN5t4XYYmXhxXdF5PjLeWf+aMc724fPIz9bFbw9HXeiVTw2YEaA==<span class="pl-pds">"</span></span>,
          <span class="pl-ent">"requires"</span>: {
            <span class="pl-ent">"@babel/runtime"</span>: <span class="pl-s"><span class="pl-pds">"</span>^7.17.7<span class="pl-pds">"</span></span>,
            <span class="pl-ent">"core-js"</span>: <span class="pl-s"><span class="pl-pds">"</span>^3.21.0<span class="pl-pds">"</span></span>
          }
        }
      }
    }
  }
}</pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.5.0</li>
<li>Node.js: v16.14.1</li>
<li>OS Name: macOs Montery (12.0.1) - Apple M1</li>
<li>System Model Name: Macbook Pro</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/moroine/.npmrc

; //registry.npmjs.org/:_authToken = (protected) ; overridden by project

; &quot;project&quot; config from /Users/moroine/Workspace/Nugit/nugit-app/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /usr/local/bin/node
; cwd = /Users/moroine/Workspace/Nugit/nugit-app
; HOME = /Users/moroine
; 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/moroine/.npmrc</span>

<span class="pl-c"><span class="pl-c">;</span> //registry.npmjs.org/:_authToken = (protected) ; overridden by project</span>

<span class="pl-c"><span class="pl-c">;</span> "project" config from /Users/moroine/Workspace/Nugit/nugit-app/.npmrc</span>

//registry.npmjs.org/:<span class="pl-k">_authToken</span> = (protected) 

<span class="pl-c"><span class="pl-c">;</span> node bin location = /usr/local/bin/node</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = /Users/moroine/Workspace/Nugit/nugit-app</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = /Users/moroine</span>
<span class="pl-c"><span class="pl-c">;</span> Run `npm config ls -l` to show all defaults.</span></pre></div>
<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">See this demo repository: <a href="https://github.com/nsams/npm-workspace-issue">https://github.com/nsams/npm-workspace-issue</a></p>
<p dir="auto">when running npm install @mdx-js/react package is installed twice:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="./packages/admin-stories/node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
./node_modules/@mdx-js/react"><pre class="notranslate"><code class="notranslate">./packages/admin-stories/node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
./node_modules/@mdx-js/react
</code></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">dependency should be installed only once</p>
<h3 dir="auto">Steps To Reproduce</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="git clone https://github.com/nsams/npm-workspace-issue
cd npm-workspace-issue
npm install
find | grep @mdx-js/react"><pre class="notranslate"><code class="notranslate">git clone https://github.com/nsams/npm-workspace-issue
cd npm-workspace-issue
npm install
find | grep @mdx-js/react
</code></pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: Ubuntu 18.04</li>
<li>Node: 14.17.1</li>
<li>npm: 7.19.0</li>
</ul>