[RRFC] Respect standard file locations
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 777
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
Motivation ("The Why")
npm currently stores files/directories in the user's home directory, which is non-standard (at least on macOS) and messy. It also interferes with apps that expect standard folder locations to be used (for example Apple Time Machine which expects cache to be stored in ~/Library/Caches).
This is a continuation of #389, which was closed due to concerns with backwards-compatibility and not valuable enough for enough users.
I explain below why I don't see any backwards compatibility issues. These points were mentioned in the original RRFC, and I've asked for thoughts about reopening it, but received no response after 5 months which is why I'm opening a new one.
On the point of it not being valuable enough for enough users, the original RRFC is in fact the 7th most upvoted. There are certainly also lots of people who are annoyed by the current behavior, but don't care enough to look for an RRFC to upvote.
For example, for Rust's cargo it's the 5th most upvoted issue with 143 upvotes (and 1 downvote).
How
Current Behaviour
npm currently stores files/directories in the user's home directory.
Desired Behaviour
To follow standard locations, the following paths would be affected:
-
The userconfig path -
~/.npm/
I can't see why there would be any backwards compatibility issues with changing the cache location. -
The config path -
~/.npmrc
This should be perfectly backwards compatible by looking for.npmrcin the following order (similar to git's approach):$XDG_CONFIG_HOME- OS-standard directory
- macOS:
~/Library/Application Support/npm/.npmrc - Linux: Not sure, maybe
~/.config/npm/.npmrcor the way it is now if that's truly standard - Windows:
%AppData%\npm\.npmrc(I think)
- macOS:
~/.npmrc
References
#389
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading this RRFC alongside superseded issue #389 and its linked discussion. Establish an agreed cross-platform path policy for the listed userconfig and config locations, including backward-compatibility behavior; done means the proposal is resolved enough to guide implementation and validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100