npm / node-which

Like which(1) unix command. Find the first instance of an executable in the PATH.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't rely on presence of `process.env.Path` to detect windows

mkmik opened this issue · comments

I noticed I couldn't install many npm packages because of:

npm ERR! not found: git

Digging deeper I noticed it's because of:

var pathEnv = opt.path || process.env.Path || process.env.PATH || ''

I have an env var on linux called Path (because it's needed by wine), so that is what gets split
I guess it would be better to check for the env var appropriate for the detected OS instead.

Environs are path-insensitive on Windows anyway, so this should be unnecessary. Probably better to just drop the check for Path since it's returned by env.PATH on Windows, and meaningless on Unix?