Allow global installation of NVM with individual user .nvm directories for Node installs #3056
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a clone of #1845; updated and rebased onto the current master and into a repo not tied to an unrelated project.
The goal is to provide a central install of NVM that permits users to have their own
$NVM_DIR
where Node installs live but have NVM's core files live elsewhere. It is still required that a user's$NVM_DIR
be a directory where the current user has full access.I'm actively using a setup like this throughout the infrastructure I manage and am testing this specific change on a CI server I control. NVM, while not intending to be multi-user, actually works quite well outside of
nvm exec
, which this PR resolves.I've made a few modifications from the original PR. Namely:
DIR
determination innvm-exec
tar
flag changes since specific flag applied appears to be the default for alltar
s I'm aware of and doesn't exist on OpenBSD'star
, as far as I could tell.With the changes to the main
nvm
script, I've noticed that it's not even required to havenvm-exec
symlinked into$NVM_DIR
when executed asnvm exec
. This change could also allow fornvm-exec
exec to be symlinked into a standard location for binaries (e.g. /usr/local/bin) to provide nvm-exec easily to system processes, though I haven't tested this personally.