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
~/.nvm directory taking up 12gb after fresh install? #2418
Comments
I would not expect the cache files to be that large, certainly - but nvm has no control over what artifacts the compile produces. Note that on an M1 Mac, you might be compiling a Rosetta version, which may have something to do with it. What does |
There appears to be a typo. The command should be As for the directory taking up so much disk space after building from source, I had a similar outcome. As noted, running |
If this is expected behaviour would it be beneficial to add a note to the readme recommending use of |
@thomasfw I don't think that should be a recommendation. What's the point of the cache if it's cleared right after populating it? |
@ljharb If those cached files didn't total > 12gb from a single install I'd probably agree. But in this case, I can't see how preserving such an enormous cache has any added benefit to me, and personally i'd take the significantly lower footprint over any speed increase the cache provides when installing different node versions (assuming that's its purpose). |
That is indeed its purpose, and since disk space is effectively infinite and free, while CPU time is quite expensive and limited, I think this is the appropriate default. You are more than welcome to |
Additionally, compiling from source is not required. The README contains instructions on how to install Node for Edit: I originally misspoke. I should have had my coffee first. The x64 binaries run under Rosetta if installed this way and run much faster than the local builds that are compiled from source. |
For what it's worth, this is strictly when attempting to install older versions of Node. Node 15 Edit: I really need to drink my coffee already. 😅 |
NodeJS don't plan on releasing M1-compatible binaries for v15 (and below). They have an issue in their repo that is tracking progress for v16 (which will include M1-compatible binaries). What I hadn't noticed before is that compiling v15 from source for M1 is not officially supported by Node which leaves running the x64 binaries through Rosetta as the current best solution. Perhaps instead of opting to compile from source, nvm could instead download the |
@zulaica if node commits to never actually providing a prebuilt arm64 binary, then we could hardcode that assumption into nvm, and not even bother attempting the arm64 one for node versions where it's never an option. |
I encountered this recently, and running That…does not sound like cache. I've compiled maybe 3 (possibly 4) minor versions of node on this laptop, and it would seem each installation generates roughly 10 GB of cache. That seems highly suspicious, like it's not actually re-using anything—unless the cache is intended for re-compiles of the exact same version?? If so, that seems like a very unlikely use-case (aside from CI) and hugely wasteful. |
The cache is solely intended for that purpose (it’s not possible to cache anything else), and the reason is mostly because disk space is effectively infinite and free, while processing time is finite and expensive. Reinstalling node happens far more often in my experience than my disk gets filled. I’d be willing to accept a PR that adds an env var that can disable automatic caching of source builds, specifically, if remembering to |
Disk space is not infinite, but SSD is simple to reclaim, so not a huge problem. Having to run It might be only me and the few dozen devs I've regularly observed using nvm, but I would bet almost no-one frequently re-builds the exact same version of node on the same machine multiple times. If true, would you accept a PR that introduces an ENV var to enable caching (where it's disabled by default)? For me, this useless cache represented 23% of my total disk space usage. That's not exactly trivial. |
That would be a breaking change, so I’m not inclined to change the default. |
Would be nice to have it be mentioned somewhere on installation. Stumbled upon this thread because of huge .nvm folder :) |
@lisovyk where would that show up? nvm's installation must be headless and promptless, or it will break use cases.
|
Has this been done? |
@cdilga nope, it's not been done; a PR would be appreciated. |
Operating system and version:
How did you install
nvm
?What steps did you perform?
nvm
.nvm install v15
What happened?
The
~/.nvm/
directory is taking up ~12gb.After running
nvm cache clear
(#1457) the directory size is 92mb.Is this normal?
The text was updated successfully, but these errors were encountered: