nvm icon indicating copy to clipboard operation
nvm copied to clipboard

Allow global installation of NVM with individual user .nvm directories for Node installs

Open chall8908 opened this issue 2 years ago • 5 comments

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:

  • Simpler DIR determination in nvm-exec
  • Applied a change recommended by @ljharb on the original PR
  • Removed the tar flag changes since specific flag applied appears to be the default for all tars I'm aware of and doesn't exist on OpenBSD's tar, as far as I could tell.

With the changes to the main nvm script, I've noticed that it's not even required to have nvm-exec symlinked into $NVM_DIR when executed as nvm exec. This change could also allow for nvm-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.

chall8908 avatar Mar 10 '23 18:03 chall8908

@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 avatar Mar 10 '23 18:03 ljharb

@ljharb I wasn't aware that was an option. I'll happily close this PR so you can update the other.

chall8908 avatar Mar 10 '23 21:03 chall8908

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.

ljharb avatar Mar 10 '23 21:03 ljharb

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?

chall8908 avatar Mar 10 '23 22:03 chall8908

oof, if so i'll have to take that up with travis. thanks, i'll investigate.

ljharb avatar Mar 10 '23 23:03 ljharb