Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm creates its cache directory in my $HOME #3384

Closed
1 task done
WhyNotHugo opened this issue Jun 8, 2021 · 8 comments
Closed
1 task done

[BUG] npm creates its cache directory in my $HOME #3384

WhyNotHugo opened this issue Jun 8, 2021 · 8 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@WhyNotHugo
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

A directory is creted in $HOME and cache data stored in there.

Expected Behavior

The cache directory should be in $XDG_CACHE_HOME on Linux. Specifically, it should be $XDG_CACHE_HOME/npm. $XDG_CACHE_HOME should default to .cache if undefined.

I believe on macOS there's a different spec for default locations, and things like cache are stored in a different place. I don't know the name of the spec so can't easily link in here.

Steps To Reproduce

Run rm -rf .cache to delete your existing cache.
Navigate to a directory with an existing package.json.
Run npm install.

Environment

  • OS: Linux 5.12.8-arch1-1 GNU/Linux
  • Node: v16.2.0
  • npm: 7.15.1
@WhyNotHugo WhyNotHugo added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Jun 8, 2021
@WhyNotHugo
Copy link
Author

Note: This bug does not need triage.

Over a dozen people have confirmed it occurring previously in #1451. I'm only opening a new issue since all old issues have been closed and we must now all waste time re-reporting and re-discussing the same issues thanks to #3351. which is great way to waste everyone's time (both for reporters and developers).

@ljharb
Copy link
Contributor

ljharb commented Jun 8, 2021

This isn’t a but, it’s a request for behavior - as such, it should be an rfc - which it is: npm/rfcs#389

@ljharb ljharb closed this as completed Jun 8, 2021
@WhyNotHugo
Copy link
Author

WhyNotHugo commented Jun 8, 2021

I might re-report this as "npm crashes with $HOME is readonly", does it really keep sense to keep playing wack-a-mole with this issue while it's affecting so many people? (see also the previous bug which has quite some history and was closed merely due to being "old").

npm behaves in a way pretty opposite to all other applications, and just litters $HOME with its cache files, instead of storing them in the appropriate location. How is that not considered a bug?

@ljharb
Copy link
Contributor

ljharb commented Jun 8, 2021

Most applications do not follow XDG; it’s not actually universal, it’s aspirational.

$HOME in any way not being fully owned and writable by the current user is also a bug on the user’s system.

@WhyNotHugo
Copy link
Author

A read-only home is a perfect workaround to avoid buggy apps (like npm in this case), from littering a user's home.

Most applications do not follow XDG

I won't get into a discussion around this. Even if you find a dozen apps out there showing the same bug, claiming that other apps are buggy is a valid reason to refuse to fix a bug in npm.

@WhyNotHugo
Copy link
Author

Note that I'm not demanding here that the bug be fixed, but at a very least reopen so discussion may continue (since the previous bug was closed merely due to being old).

@ljharb
Copy link
Contributor

ljharb commented Jun 8, 2021

The RFC i linked is where that discussion will happen. “Not supporting XDG” when not claiming to is simply never a bug.

@WhyNotHugo
Copy link
Author

I misunderstood the link to the RFC, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants