Skip to content

default prefix not resolved when using Brew to install node #7

@mhofman

Description

@mhofman

When node is installed using brew, the process.execPath isn't /usr/local/bin/node, which causes the default prefix to be invalidly resolved.

According to the npm config documentation, the config is resolved from the following places:

  1. per-project config file (/path/to/my/project/.npmrc)
  2. per-user config file (~/.npmrc)
  3. global config file ($PREFIX/etc/npmrc)
  4. npm builtin config file (/path/to/npm/npmrc)

The problem is that 3) & 4) are not possible to figure out without resolving the location of npm. The rc package will only find the configs in 1), 2) and sometimes 3) depending on the prefix.
In particular 4) caused issue #4 on Windows, which was solved by hard coding the content of the npm builtin prefix config.

Unless someone has a better suggestion, I suggest that we hard code the default prefix location on all platforms, similar to Windows.
This shouldn't have an impact since after #6, the resolve process first tries using prefix and then using the process.execPath anyway, which means that even if we hardcode the wrong default prefix, the execPath based resolution will still happen as it currently does.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions