Joining PATH with ':' silently no-ops on Windows
env paths · case
Affectsnode, powershell 51, pwsh 7, windows
Fails assilent
Mechanismpath delimiter
Safe fixpath win32 delimiter
Symptom
Section titled “Symptom”A test or script prepends a directory to PATH with a colon: PATH = binDir + “:” + oldPath. On Windows the tool in binDir is never found — no error, the entry just does not participate in resolution.
process.env.PATH = binDir + ":" + process.env.PATH; // POSIX habit// Windows PATH is ;-separated: the whole thing becomes ONE bogus entry// "C:\\bin:C:\\Windows\\system32;..." — binDir is unfindable.Windows separates PATH entries with semicolons; colons appear INSIDE entries as drive designators (C:). A colon-joined PATH fuses your new directory with the first original entry into one nonexistent path. The same bug appears in PowerShell as $env:Path = “$bin:$env:Path”.
Workaround
Section titled “Workaround”- Use the platform delimiter: Node path.delimiter (the referenced fix), or [IO.Path]::PathSeparator in PowerShell.
- Sibling traps: splitting on ‘:’ shreds C:\ entries (node-path-host- delimiter) and duplicate Path/PATH casings fight each other (env-path-vs-PATH-casing).