<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">When running an npm script with a colon (<code class="notranslate">:</code>) in its name, Windows will return a number of different errors.</p>
<p dir="auto">Sometimes the error is as follows:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="The filename, directory name, or volume label syntax is incorrect."><pre class="notranslate"><code class="notranslate">The filename, directory name, or volume label syntax is incorrect.
</code></pre></div>
<p dir="auto">At other times, this error occurs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Error: ENOENT: no such file or directory, open 'C:\Users\Chris\AppData\Local\Temp\foo:bar-1656368147831.cmd'
    at Object.openSync (node:fs:585:3)
    at writeFileSync (node:fs:2170:35)
    at makeSpawnArgs (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:82:3)
    at runScriptPkg (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:57:55)
    at runScript (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:9:16)
    at RunScript.run (C:\Program Files\nodejs\node_modules\npm\lib\commands\run-script.js:125:13)
    at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli.js:78:5)"><pre class="notranslate"><code class="notranslate">Error: ENOENT: no such file or directory, open 'C:\Users\Chris\AppData\Local\Temp\foo:bar-1656368147831.cmd'
    at Object.openSync (node:fs:585:3)
    at writeFileSync (node:fs:2170:35)
    at makeSpawnArgs (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\make-spawn-args.js:82:3)
    at runScriptPkg (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:57:55)
    at runScript (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:9:16)
    at RunScript.run (C:\Program Files\nodejs\node_modules\npm\lib\commands\run-script.js:125:13)
    at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli.js:78:5)
</code></pre></div>
<p dir="auto">I haven't been able to nail down exactly what causes the differing behavior, sometimes they will alternate when I run the same command, in the same terminal session, one right after the other.</p>
<p dir="auto">Interestingly, when I highlight the name of the "missing" file in the VS Code integrated terminal, only the path up to the first colon is highlighted as being a navigable path.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">When I use <code class="notranslate">npm run foo:bar</code>, I'd like it to successfully execute the script of the same name.</p>
<p dir="auto">When I roll back to npm 8.11.0 using nvm, I get the irritating <code class="notranslate">config global '--global', '--local' are deprecated. Use '--location=global' instead.</code> error, but I am able to successfully execute scripts with colons in their names.</p>
<h3 dir="auto">Workaround</h3>
<p dir="auto">I'm extremely confident that this issue between npm and the Windows filesystem is caused by the colons, because when I change the name of the script by replacing the colons with hyphens (<code class="notranslate">foo:bar</code> to <code class="notranslate">foo-bar</code>), the script works perfectly.</p>
<p dir="auto">When I mentioned this problem to my coworkers, they said that they were able to use scripts w/ colon names without issue. I had updated my npm that morning, but they were still using npm version <code class="notranslate">8.11</code>, so this error is definitely caused by something that was changed in the last few versions.</p>
<p dir="auto">I don't yet know whether npm 8.12 has similar problems.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<p dir="auto">In a Windows 10 environment...</p>
<ol dir="auto">
<li>Install or update to npm 8.13.1</li>
<li>Initialize or navigate to a node.js project</li>
<li>Within the <code class="notranslate">scripts</code> section of <code class="notranslate">package.json</code>:<br>
a. Create a script with a colon in its name (ex. <code class="notranslate">foo:bar</code>)<br>
b. The actual contents of the script don't matter, just the name</li>
<li>From a command prompt or Powershell terminal, execute <code class="notranslate">npm run foo:bar</code> [or whatever the name of the script is]</li>
<li>Observe one of the above mentioned errors, either<br>
a. <code class="notranslate">filename, directory name, or volume label syntax is incorrect</code><br>
b. <code class="notranslate">no such file or directory</code></li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.13.1</li>
<li>Node.js: v16.15.1</li>
<li>OS Name: Windows 10 21H2 (Build 19044.1766)</li>
<li>System Model Name: Dell Precision 5550</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;builtin&quot; config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = &quot;C:\\Users\\Chris\\AppData\\Roaming\\npm&quot;

; &quot;global&quot; config from C:\Users\Chris\AppData\Roaming\npm\etc\npmrc

include = [&quot;dev&quot;]
omit = []

; &quot;user&quot; config from C:\Users\Chris\.npmrc

strict-ssl = false

; &quot;project&quot; config from C:\Users\Chris\development\spotify-playlist-maker\.npmrc

always-auth = true
registry = &quot;https://registry.npmjs.org/&quot;

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.15.1
; npm local prefix = C:\Users\Chris\development\spotify-playlist-maker
; npm version = 8.13.1
; cwd = C:\Users\Chris\development\spotify-playlist-maker
; HOME = C:\Users\Chris
; Run `npm config ls -l` to show all defaults."><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc</span>

<span class="pl-k">prefix</span> = <span class="pl-s"><span class="pl-pds">"</span>C:\\Users\\Chris\\AppData\\Roaming\\npm<span class="pl-pds">"</span></span>

<span class="pl-c"><span class="pl-c">;</span> "global" config from C:\Users\Chris\AppData\Roaming\npm\etc\npmrc</span>

<span class="pl-k">include</span> = [<span class="pl-s"><span class="pl-pds">"</span>dev<span class="pl-pds">"</span></span>]
<span class="pl-k">omit</span> = []

<span class="pl-c"><span class="pl-c">;</span> "user" config from C:\Users\Chris\.npmrc</span>

<span class="pl-k">strict-ssl</span> = false

<span class="pl-c"><span class="pl-c">;</span> "project" config from C:\Users\Chris\development\spotify-playlist-maker\.npmrc</span>

<span class="pl-k">always-auth</span> = true
<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>https://registry.npmjs.org/<span class="pl-pds">"</span></span>

<span class="pl-c"><span class="pl-c">;</span> node bin location = C:\Program Files\nodejs\node.exe</span>
<span class="pl-c"><span class="pl-c">;</span> node version = v16.15.1</span>
<span class="pl-c"><span class="pl-c">;</span> npm local prefix = C:\Users\Chris\development\spotify-playlist-maker</span>
<span class="pl-c"><span class="pl-c">;</span> npm version = 8.13.1</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = C:\Users\Chris\development\spotify-playlist-maker</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = C:\Users\Chris</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">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 am unable to run scripts defined in my package.json. <code class="notranslate">npm run &lt;script&gt;</code> outputs <code class="notranslate">The filename, directory name, or volume label syntax is incorrect.</code> (translated from german 'Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.')<br>
Downgrading to v8.12.2 for now as scripts are able to run using this npm version.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">All scripts should run without an error.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Install the latest npm version 8.13.0 globally</li>
<li>Run any script defined in your package.json</li>
<li>See error: <code class="notranslate">The filename, directory name, or volume label syntax is incorrect.</code> (translated from german 'Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.')</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>npm: 8.13.0</li>
<li>Node.js: 16.15.1</li>
<li>OS Name: Windows 10</li>
<li>System Model Name: HP ZBook</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;builtin&quot; config from C:\Users\[retracted]\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = &quot;C:\\Users\\[retracted]\\AppData\\Roaming\\npm&quot;

; &quot;user&quot; config from C:\Users\[retracted]\.npmrc

[retracted]:registry = &quot;[retracted]&quot;
[retracted]:registry = &quot;[retracted]&quot;
[retracted]
registry = &quot;[retracted]&quot;

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.15.1
; npm local prefix = [retracted]
; npm version = 8.13.0
; cwd = [retracted]
; HOME = C:\Users\[retracted]
; Run `npm config ls -l` to show all defaults."><pre class="notranslate"><span class="pl-c"><span class="pl-c">;</span> "builtin" config from C:\Users\[retracted]\AppData\Roaming\npm\node_modules\npm\npmrc</span>

<span class="pl-k">prefix</span> = <span class="pl-s"><span class="pl-pds">"</span>C:\\Users\\[retracted]\\AppData\\Roaming\\npm<span class="pl-pds">"</span></span>

<span class="pl-c"><span class="pl-c">;</span> "user" config from C:\Users\[retracted]\.npmrc</span>

<span class="pl-en">[retracted]</span>:<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>[retracted]<span class="pl-pds">"</span></span>
<span class="pl-en">[retracted]</span>:<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>[retracted]<span class="pl-pds">"</span></span>
<span class="pl-en">[retracted]</span>
<span class="pl-k">registry</span> = <span class="pl-s"><span class="pl-pds">"</span>[retracted]<span class="pl-pds">"</span></span>

<span class="pl-c"><span class="pl-c">;</span> node bin location = C:\Program Files\nodejs\node.exe</span>
<span class="pl-c"><span class="pl-c">;</span> node version = v16.15.1</span>
<span class="pl-c"><span class="pl-c">;</span> npm local prefix = [retracted]</span>
<span class="pl-c"><span class="pl-c">;</span> npm version = 8.13.0</span>
<span class="pl-c"><span class="pl-c">;</span> cwd = [retracted]</span>
<span class="pl-c"><span class="pl-c">;</span> HOME = C:\Users\[retracted]</span>
<span class="pl-c"><span class="pl-c">;</span> Run `npm config ls -l` to show all defaults.</span></pre></div>