zkat / npx

execute npm package binaries (moved)
https://github.com/npm/npx
Other
2.63k stars 105 forks source link

Conform to NPM behavior when dealing with paths that include `path.delimiter` #207

Open Xunnamius opened 6 years ago

Xunnamius commented 6 years ago

The problem is illustrated succinctly below:

2018-09-14

Essentially, both Linux and Windows allow for path.delimiter to appear in directory names. NPM handles this gracefully in all cases that I've encountered, but the latest NPX chokes.

A little background on why I have to put a colon in my directory name:

I develop on Windows (VS Code) but the vast majority of my source lives on my Linux box. I do a lot of debugging using Chrome's DevTools and Node's inspector. Due to VS Code's strange path mapping and lax/outdated documentation, I just decided to replicate the Windows path—including the "root" colon—on Linux so everything would Just Work (tm). And now everything does work! ... except now NPX doesn't work. After some digging, it turned out that it was because NPX prepends npm bin to process.env.PATH, even if the prepended path has the OS's path.delimiter in it.

NPM handles this gracefully AFAIK. I believe NPX should parallel NPM in this regard.