volta icon indicating copy to clipboard operation
volta copied to clipboard

Volta bin stubs are invalid after renaming the local user

Open mmun opened this issue 3 years ago • 1 comments

If the user renames their account, then the symlinks in the ~/.volta/bin folder may no longer be valid. I didn't run into this issue myself, but a coworker got tripped up on it.

Specifically, you can end up in a situation like this:

❯ ls -la /Users/NEW_USER/.volta/bin/
total 29560
drwxr-xr-x  19 NEW_USER  staff      608  9 Aug 17:05 .
drwxr-xr-x   9 NEW_USER  staff      288 14 Mar 13:24 ..
lrwxr-xr-x   1 NEW_USER  staff       35 25 Jul 16:28 node -> /Users/OLD_USER/.volta/bin/volta-shim
lrwxr-xr-x   1 NEW_USER  staff       35 25 Jul 16:28 nodemon -> /Users/OLD_USER/.volta/bin/volta-shim
lrwxr-xr-x   1 NEW_USER  staff       35 25 Jul 16:28 npm -> /Users/OLD_USER/.volta/bin/volta-shim
...

where /Users/OLD_USER no longer exists.

Some ideas:

  • Use relative symlinks instead of absolute symlinks
  • Add a command to rebuild the shims

mmun avatar Aug 31 '22 21:08 mmun

@mmun Thanks for reporting! I think in many common cases, we should be able to use relative links. There are a few situations where the binaries we're linking to aren't in the same directory, where I think we would still want to use absolute symlinks, however in those situations, the path shouldn't include the username anyway, so the issue wouldn't even present itself in the first place 😄

charlespierce avatar Aug 31 '22 23:08 charlespierce