BUG: On Windows, binaries are installed in the wrong location
Closed this issue · 2 comments
sounisi5011 commented
On Windows, the globally installed CLI is placed in the {npm_config_prefix}
directory, not the {npm_config_prefix}/bin
directory.
When in global mode, executables are linked into
{prefix}/bin
on Unix, or directly into{prefix}
on Windows. Ensure that path is in your terminal'sPATH
environment to run them.
--- folders | npm Docs
However, the current installation logic seems to always install in the bin
directory:
Lines 41 to 43 in 5b4b644
I think this code needs to be fixed like this:
if (env && env.npm_config_prefix) {
- dir = join(env.npm_config_prefix, 'bin');
+ if (process.platform === 'win32') {
+ dir = env.npm_config_prefix;
+ } else {
+ dir = join(env.npm_config_prefix, 'bin');
+ }
} else if (env && env.npm_config_local_prefix) {
sounisi5011 commented
If this is granted, I would like to create a pull request to reflect this fix.
andreynering commented
Hi @sounisi5011,
Yes, a PR would be helpful!