<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">If the working directory's name differs from the name of the npm package it contains, then the generated package-lock.json has a ["packages"][""]["name"] property in violation of the npm v7 spec for the package-lock.json file per the docs at <a href="https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json" rel="nofollow">https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json</a><br>
for example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;impact-api&quot;,
  &quot;version&quot;: &quot;2.27.0&quot;,
  &quot;lockfileVersion&quot;: 2,
  &quot;requires&quot;: true,
  &quot;packages&quot;: {
    &quot;&quot;: {
      &quot;name&quot;: &quot;impact-api&quot;,
      &quot;version&quot;: &quot;2.27.0&quot;,
      &quot;license&quot;: &quot;UNLICENSED&quot;,
      &quot;dependencies&quot;: {
..."><pre class="notranslate"><code class="notranslate">{
  "name": "impact-api",
  "version": "2.27.0",
  "lockfileVersion": 2,
  "requires": true,
  "packages": {
    "": {
      "name": "impact-api",
      "version": "2.27.0",
      "license": "UNLICENSED",
      "dependencies": {
...
</code></pre></div>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">The generated package-lock.json file should not have a "name" property under ["packages"][""]<br>
for example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;impact-api&quot;,
  &quot;version&quot;: &quot;2.27.0&quot;,
  &quot;lockfileVersion&quot;: 2,
  &quot;requires&quot;: true,
  &quot;packages&quot;: {
    &quot;&quot;: {
      &quot;version&quot;: &quot;2.27.0&quot;,
      &quot;license&quot;: &quot;UNLICENSED&quot;,
      &quot;dependencies&quot;: {
..."><pre class="notranslate"><code class="notranslate">{
  "name": "impact-api",
  "version": "2.27.0",
  "lockfileVersion": 2,
  "requires": true,
  "packages": {
    "": {
      "version": "2.27.0",
      "license": "UNLICENSED",
      "dependencies": {
...
</code></pre></div>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>clone an npm project/package e.g. from GitHub into a filesystem directory whose <code class="notranslate">name</code> differs from the name of the npm package</li>
<li>remove package-lock.json and the ./node_modules directory if they exist</li>
<li>Run <code class="notranslate">npm i</code></li>
<li>The generated package-lock.json contains an errant ["packages"][""]["name"] property in violation of the npm v7 spec for the package-lock.json file per the docs at <a href="https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json" rel="nofollow">https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json</a></li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: macOS Big Sur Version 11.1</li>
<li>Node: 14.16.0</li>
<li>npm: 7.6.0</li>
</ul>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">package-lock.json changes depending on name of local copy of git repo, e.g. if i have two copies of the same repo locally one which matches the name in package.json and one which doesn't i get two different package-lock files, one specifies the name of the package in the inner packages list and one doesn't.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">package-lock.json should be independent of top level directory name, when working in a team there shouldn't be unnecessary changes to package-lock file due to a team member having a different local name of their git repository.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>clone a repository twice one in the default named directory and one into a name that differs from the repo name.</li>
<li>run <code class="notranslate">npm install</code></li>
<li>two different package-lock files will be generated.</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS: Ubuntu 20.04</li>
<li>Node: 15.3.0</li>
<li>npm: 7.0.14</li>
</ul>