Skip to content

BUG: On Windows, binaries are installed in the wrong location #4

Closed
@sounisi5011

Description

@sounisi5011

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's PATH environment to run them.
--- folders | npm Docs

However, the current installation logic seems to always install in the bin directory:

go-npm/src/common.js

Lines 41 to 43 in 5b4b644

if (env && env.npm_config_prefix) {
dir = join(env.npm_config_prefix, 'bin');
} else if (env && env.npm_config_local_prefix) {

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) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions