Skip to content

Calling node shouldn't add yarn to the PATH (calling yarn should) #2053

Description

@arcanis

Generally speaking, only tools that matter to the current process should be injected to the PATH. For example, running node ... should only add .volta/tools/image/node/22.13.1/bin to the PATH, not .volta/tools/image/yarn/1.22.19/bin. This last path should only be added to the PATH once the yarn shim is actually called.

The reason for that is that until the Yarn shim is called, Volta doesn't know whether it would ever be called. For example on my system only Node is managed by Volta on some projects, with the global yarn binary coming from another source, let's say /path/to/my/yarn. Unfortunately when calling execFile from within Node the Volta Yarn is unexpectedly called because Volta force-injected the shim.

As a workaround for this issue users can remove the yarn field from the ~/.volta/tools/user/platform.json file - this will prevent Volta from finding a path for Yarn, and thus to add it into the PATH.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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