<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">Using <code class="notranslate">vsce</code> in vscode extension workspace throws errors for missing dependencies.</p>
<p dir="auto">I have several VSCode extensions that am moving together in monorepo with npm workspace.<br>
All the dependencies for the extensions are hoisted at the root node_modules.<br>
To prepare the vscode extension packages I use the <code class="notranslate">vsce</code> tool, that internally uses:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm list --production --depth=99999 --loglevel=error"><pre class="notranslate"><code class="notranslate">npm list --production --depth=99999 --loglevel=error
</code></pre></div>
<p dir="auto">to collect all npm modules that need to be backed in the VSCode extension.<br>
The command is executed in the directory of each workspace, and fails with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm ERR! missing: @aspnet/signalr@^1.1.4, required by blazortemplatewizard@1.2.1
npm ERR! missing: @types/app-root-path@^1.2.4, required by blazortemplatewizard@1.2.1
npm ERR! missing: @types/archiver@^2.1.3, required by blazortemplatewizard@1.2.1"><pre class="notranslate"><code class="notranslate">npm ERR! missing: @aspnet/signalr@^1.1.4, required by blazortemplatewizard@1.2.1
npm ERR! missing: @types/app-root-path@^1.2.4, required by blazortemplatewizard@1.2.1
npm ERR! missing: @types/archiver@^2.1.3, required by blazortemplatewizard@1.2.1
</code></pre></div>
<p dir="auto">however these are already installed in node_modules a few folders up.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Using <code class="notranslate">vsce</code> in vscode extension workspace to pack correctly.</p>
<p dir="auto">From what I understand it may need changes in that external <code class="notranslate">vsce</code> tool as well, but first the <code class="notranslate">npm ls --production</code> will need to either change behaviour to look in node_modules outside the current folder, or perhaps a new switch like <code class="notranslate">--include-workspace-deps</code> to look modules up. I hope I am missing something that could get this running.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<p dir="auto">Create a project with few workspaces.<br>
Install the dependencies in at the root.<br>
cd into one of the workspaces.<br>
run <code class="notranslate">npm list</code></p>
<p dir="auto">It will generate errors for missing dependencies, that had been installed at the root level.</p>
<p dir="auto">I've prepared a small repo that shows the list failing if the deps are installed at the root level, and how it works when the deps are installed locally in each dependency:</p>
<p dir="auto"><a href="https://github.com/panayot-cankov/npm-list-repro">https://github.com/panayot-cankov/npm-list-repro</a></p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: Windows</li>
<li>Node: 14.16.0</li>
<li>npm: 1.16.0</li>
</ul>
<p dir="auto">Hooks for scopes get a double prefix, ie <code class="notranslate">@@scope</code>, when shown with the <code class="notranslate">npm hook ls</code> command. This is due to the response from the web request already including the prefix in the <code class="notranslate">name</code> field, and the <a href="https://github.com/npm/cli/blob/d8aac8448e983692cacb427e03f4688cd1b62e30/lib/commands/hook.js#L123-L132">following lines</a> of code then locally adding the prefix again, duplicating it.</p>