<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">WinOS</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><em>No response</em></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:</li>
<li>Node.js:</li>
<li>OS Name:</li>
<li>System Model Name:</li>
<li>npm config:</li>
</ul>
<div class="highlight highlight-source-ini notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="; copy and paste output from `npm config ls` here"><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> copy and paste output from `npm config ls` here</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">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">OS name: WinOS<br>
OS version: Microsoft Windows [Version 10.0.19044.2486]<br>
node v18.6.0<br>
npm v9.3.0</p>
<p dir="auto">I ran into an <em>ugly</em> bug when trying to publish some packages over the weekend. With a horribly vague error message, it was quite a task to determine the actual problem. After much churn, here's the simple reproducible case I was able to generate:</p>
<ul dir="auto">
<li><em>package.json</em></li>
</ul>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;@rivy-labs/-x-8ff8f63d-6ef9-44ee-999b-fc9edf489c98-basic&quot;,
  &quot;version&quot;: &quot;2.0.0&quot;,
  &quot;description&quot;: &quot;&quot;,
  &quot;main&quot;: &quot;index.js&quot;,
  &quot;scripts&quot;: {
    &quot;test&quot;: &quot;require('fs').writeFileSync()&quot;
  },
  &quot;author&quot;: &quot;Roy Ivy III &lt;rivy.dev@gmail.com&gt; (https://rivy.dev/)&quot;,
  &quot;license&quot;: &quot;MIT&quot;
}"><pre class="notranslate">{
  <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>@rivy-labs/-x-8ff8f63d-6ef9-44ee-999b-fc9edf489c98-basic<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>2.0.0<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"description"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
  <span class="pl-ent">"main"</span>: <span class="pl-s"><span class="pl-pds">"</span>index.js<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"scripts"</span>: {
    <span class="pl-ent">"test"</span>: <span class="pl-s"><span class="pl-pds">"</span>require('fs').writeFileSync()<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"author"</span>: <span class="pl-s"><span class="pl-pds">"</span>Roy Ivy III &lt;rivy.dev@gmail.com&gt; (https://rivy.dev/)<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"license"</span>: <span class="pl-s"><span class="pl-pds">"</span>MIT<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto"><code class="notranslate">npm publish</code> fails with this vaguely horrifying message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@rivy-labs%2f-x-npm_***-basic
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to."><pre lang="text" class="notranslate"><code class="notranslate">npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@rivy-labs%2f-x-npm_***-basic
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
</code></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><code class="notranslate">npm publish</code> succeeds.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ul dir="auto">
<li>Create a new package with <code class="notranslate">npm init</code>
<ul dir="auto">
<li><code class="notranslate">npm publish</code> will succeed (ie, <a href="https://www.npmjs.com/package/@rivy-labs/-x-8ff8f63d-6ef9-44ee-999b-fc9edf489c98-basic" rel="nofollow">https://www.npmjs.com/package/@rivy-labs/-x-8ff8f63d-6ef9-44ee-999b-fc9edf489c98-basic</a>)</li>
</ul>
</li>
<li>Change the "test" script text to "require('fs').writeFileSync()"
<ul dir="auto">
<li><code class="notranslate">npm publish</code> fails with <code class="notranslate">E403...</code></li>
</ul>
</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS Name: Windows</li>
</ul>