volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
10.33k stars 220 forks source link

Running Node with Volta with TMP options #1718

Open ubuntupunk opened 3 months ago

ubuntupunk commented 3 months ago

This is probably a feature request, but an easy way to deal with drives running out of space, and dealing with a TMP directory on a secondary drive. Currently no spec for doing with Volta.

chriskrycho commented 3 months ago

Thanks for filing this, @ubuntupunk! Can you elaborate slightly for the sake of a clear end-to-end feature request?

ubuntupunk commented 3 months ago

An example spec with pip: TMPDIR=/media/user/TMP pip install --cache-dir=$TMPDIR --build $TMPDIR -r requirements.txt

or npm which has an npm install --prefix option to set the node modules install directory (still not ideal)

Volta currently defaults to installing toolchains inside the user home directory. A flag to split or move the load to either another drive, or a tmp directory on a etc would be a great help.

I should be able to just ask Volta to resolve my node space problems, and not bother again?

On Wed, 20 Mar 2024 at 15:12, Chris Krycho @.***> wrote:

Thanks for filing this, @ubuntupunk https://github.com/ubuntupunk! Can you elaborate slightly for the sake of a clear end-to-end feature request?

— Reply to this email directly, view it on GitHub https://github.com/volta-cli/volta/issues/1718#issuecomment-2009537085, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB4HBTYPAZMW3XRPXNMGTDYZGDLRAVCNFSM6AAAAABE5KY4OSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBZGUZTOMBYGU . You are receiving this because you were mentioned.Message ID: @.***>

chriskrycho commented 3 months ago

That makes sense, yep! I think that's a good feature, and we would “just” need to update the layout crate to support that, since the tmp dir (as far as I know/can see) is currently “hard coded” as part of that. @charlespierce might remember differently if that is not true, though!

charlespierce commented 3 months ago

There's some trickiness with splitting up the .volta directory IIRC: Specifically, the function that we use to move files around when doing an install, std::fs::rename explicitly doesn't work if the two paths are on different mount points. That's actually the reason that we have a /tmp directory inside of .volta, so we can be confident that they are on the same drive.

That said @ubuntupunk, you should be able to move the entire Volta directory (including all of its cache files) to a different drive. By default, we install into ~/.volta, but it can be customized with the VOLTA_HOME environment variable. The standard installation sets that in your profile script (e.g. .zshrc or .bash_profile), so updating that to point to a different location should be all that is needed. That would affect the entire Volta installation, however, would that work for your use-case?

ubuntupunk commented 3 months ago

Yes, it makes sense. But not if you need this just for one project with a large code base. Thanks for responding.

On Tue, 2 Apr 2024 at 06:59, Charles Pierce @.***> wrote:

There's some trickiness with splitting up the .volta directory IIRC: Specifically, the function that we use to move files around when doing an install, std::fs::rename https://doc.rust-lang.org/std/fs/fn.rename.html explicitly doesn't work if the two paths are on different mount points. That's actually the reason that we have a /tmp directory inside of .volta, so we can be confident that they are on the same drive.

That said @ubuntupunk https://github.com/ubuntupunk, you should be able to move the entire Volta directory (including all of its cache files) to a different drive. By default, we install into ~/.volta, but it can be customized with the VOLTA_HOME environment variable. The standard installation sets that in your profile script (e.g. .zshrc or .bash_profile), so updating that to point to a different location should be all that is needed. That would affect the entire Volta installation, however, would that work for your use-case?

— Reply to this email directly, view it on GitHub https://github.com/volta-cli/volta/issues/1718#issuecomment-2031085127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB4HBS4PG4SATYVUCGE6BTY3I3JZAVCNFSM6AAAAABE5KY4OSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZRGA4DKMJSG4 . You are receiving this because you were mentioned.Message ID: @.***>