[Bug] Home config interaction w/ Yarn 1

Open
#2,121 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
node.js, typescript
Domain
cli, tooling

Research direction

Start by reproducing the setup with a home and project .yarnrc.yml containing different yarnPath values, then run yarn --version from the project. Trace Yarn's configuration resolution to determine why the home file wins; done means the closest project configuration takes precedence and the reported version is 2.3.1.

Written by the indexing model from the issue text.

Description

bug external bug upholded

Describe the user story

If I have:

  • ~/.yarnrc.yml (home directory Yarnrc file) with yarnPath pointing to e.g. v1.22.10
  • ~/project/.yarnrc.yml (project-level Yarnrc file) with yarnPath pointing to e.g. v2.3.1

Then cd ~/project && yarn --version should yield version 2.3.1, not 1.22.10.

Describe the solution you'd like

Respect the closest Yarnrc file – it should have higher priority / take precedence over my global config.

Describe the drawbacks of your solution

Not sure if home directory's Yarnrc file isn't special somehow. Maybe some people depend on the current behavior?

Describe alternatives you've considered

N/A

Additional context

This was a major gotcha for one of my colleagues today, hard to debug. We were not sure why Yarn "misbehaves" when everything seemed correct. It turned out that there was a yarnPath in the home directory and that has overwritten our project setup.

Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yarnpkg/berry

All issues in yarnpkg/berry

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.