-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Allow global installation of NVM with individual user .nvm directories for Node installs #3056
base: master
Are you sure you want to change the base?
Conversation
…em-wide installs with a localized Nodes. Let's say we have nvm installed in a separate mount, /.socket. NVM_DIR is $HOME/.nvm in /etc/profile.d/nvm.sh. With this setup, users can install Node versions to their home directories without each installing nvm. nvm install --lts This works fine as does nvm use --lts. When nvm exec is used though, it fails because it looks for nvm-exec in $NVM_DIR. First fix is to look for nvm-exec in $NVM_DIR. If NVM_DIR does not contain nvm-exec, check $BASH_SOURCE[0]. The second fix is to follow nvm-exec if a symbolic link to determine the proper location of nvm's home. Alternatively we could use a second environment variable, NVM_HOME in exec instead of relying on the directory name of nvm-exec.
@chall8908 please don't open duplicate PRs - instead post a link to the branch on the original one and I can update it. Now I have to keep both PRs in sync :-/ |
@ljharb I wasn't aware that was an option. I'll happily close this PR so you can update the other. |
Please don't; once opened a PR ref can never be deleted, so i'd rather keep them in sync. Feel free to keep updating this one to get tests passing. |
The failing Travis tests appear to be Python errors from the Node source itself. The errors all appear to be things expecting Python 2 and getting Python 3. I noticed that the past few test runs have all failed on these tests with the same errors from the few I spot checked. I'm wondering now if this isn't something that changed inside Travis somehow. Thoughts? |
oof, if so i'll have to take that up with travis. thanks, i'll investigate. |
c6cfc3a
to
c20db2a
Compare
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.