<p dir="auto">Hello,</p>
<p dir="auto">When unpublishing a package into an internal repository (such as artifactory) where the registry contains a path, the tarballUrl bellow (unpublish.js:71) will be wrong as it will contain the full registry path</p>
<p dir="auto"><code class="notranslate">const tarballUrl = url.parse(dist.tarball).pathname.substr(1)</code></p>
<p dir="auto">Example :</p>
<p dir="auto">C:&gt;npm unpublish  <a href="mailto:my-app@1.0-SNAPSHOT">my-app@1.0-SNAPSHOT</a> --verbose --force --registry <a href="https://artifactory.example.com/api/npm/npm-snapshots/" rel="nofollow">https://artifactory.example.com/api/npm/npm-snapshots/</a><br>
npm info it worked if it ends with ok<br>
npm verb cli [ 'C:\Tools\node-v10.16.3-win-x64\node.exe',<br>
npm verb cli   'C:\Tools\node-v10.16.3-win-x64\node_modules\npm\bin\npm-cli.js',<br>
npm verb cli   'unpublish',<br>
npm verb cli   '<a href="mailto:my-app@1.0-SNAPSHOT">my-app@1.0-SNAPSHOT</a>',<br>
npm verb cli   '--verbose',<br>
npm verb cli   '--force',<br>
npm verb cli   '--registry',<br>
npm verb cli   'https://artifactory.example.com/api/npm/npm-snapshots/' ]<br>
npm info using npm@6.9.0<br>
npm info using node@v10.16.3<br>
npm WARN using --force I sure hope you know what you are doing.<br>
npm verb npm-session 501f69ac7af05ab3<br>
npm http fetch GET 200 <a href="https://artifactory.example.com/api/npm/npm-snapshots/my-app?write=true" rel="nofollow">https://artifactory.example.com/api/npm/npm-snapshots/my-app?write=true</a> 372ms<br>
npm http fetch PUT 200 <a href="https://artifactory.example.com/api/npm/npm-snapshots/my-app/-rev/1-0" rel="nofollow">https://artifactory.example.com/api/npm/npm-snapshots/my-app/-rev/1-0</a> 44ms<br>
npm http fetch GET 304 <a href="https://artifactory.example.com/api/npm/npm-snapshots/my-app?write=true" rel="nofollow">https://artifactory.example.com/api/npm/npm-snapshots/my-app?write=true</a> 93ms<br>
npm http fetch DELETE 200 <a href="https://artifactory.example.com/api/npm/npm-snapshots/api/npm/npm-snapshots/my-app/-/my-app-1.0-SNAPSHOT.tgz/-rev/1-0" rel="nofollow">https://artifactory.example.com/api/npm/npm-snapshots/api/npm/npm-snapshots/my-app/-/my-app-1.0-SNAPSHOT.tgz/-rev/1-0</a> 79ms<br>
<a href="mailto:-my-app@1.0-SNAPSHOT">-my-app@1.0-SNAPSHOT</a><br>
npm verb exit [ 0, true ]<br>
npm timing npm Completed in 5982ms<br>
npm info ok</p>
<p dir="auto">The last DELETE fetch is wrong the registry path has been duplicated</p>
<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 use a private repository on Nexus, <strong>my configuration works with NPM 8.3.0</strong><br>
From a docker image node:lts, I run the command:<br>
<code class="notranslate">npm ci --maxsockets=3</code><br>
This fails with NPM 8.3.1 to NPM 8.5.0 :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network request to https://nexus.biosency.com/repository/boraconnect-front/yargs/-/yargs-13.1.0.tgz failed, reason: Socket timeout"><pre class="notranslate"><code class="notranslate">npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network request to https://nexus.biosency.com/repository/boraconnect-front/yargs/-/yargs-13.1.0.tgz failed, reason: Socket timeout
</code></pre></div>
<p dir="auto">If I  rollback to NPM 8.3.0, It works<br>
There is no cache since it's a virtual machine with a gitlab runner without cache configration</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Modules are installed from my private repository on Nexus</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>In this environment...</li>
<li>With this config...</li>
<li>Run '...'</li>
<li>See error...</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.5.0</li>
<li>Node.js: 16.14.0</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 /root/.npmrc

//nexus.biosency.com/repository/boraconnect-front/:_password = (protected) 
//nexus.biosency.com/repository/boraconnect-front/:username = &quot;npm&quot; 
registry = &quot;https://nexus.biosency.com/repository/boraconnect-front/&quot; 
"><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "user" config from /root/.npmrc</span>

//nexus.biosency.com/repository/boraconnect-front/:<span class="pl-k">_password</span> = (protected) 
//nexus.biosency.com/repository/boraconnect-front/:<span class="pl-k">username</span> = <span class="pl-s"><span class="pl-pds">"</span>npm<span class="pl-pds">"</span></span> 
<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>https://nexus.biosency.com/repository/boraconnect-front/<span class="pl-pds">"</span></span> 
</pre></div>