volta icon indicating copy to clipboard operation
volta copied to clipboard

Uninstalling Package by Binary Name

Open hffmnn opened this issue 4 years ago • 5 comments

When running the list command, I get the following:

❯ volta list                                                                                                                                                                                                      
⚡️ Currently active tools:

    Node: v12.19.0 (default)
    Yarn: v1.22.10 (default)
    Tool binaries available:
        firebase (default)

When trying to uninstall I get this:

❯ volta uninstall firebase --verbose                                                                                                                                                                              
[verbose] Acquiring lock on Volta directory: /Users/christian/.volta/volta.lock
warning:  No package 'firebase' found to uninstall
[verbose] Unlocking Volta Directory
[verbose] No custom hooks found
❯ which firebase                                                                                                                                                                                                  
~/.volta/bin/firebase

Did I misunderstand the usage of volta somehow?

hffmnn avatar Apr 21 '21 14:04 hffmnn

Hi @hffmnn, thanks for reporting! You didn't misunderstand the usage of Volta, we definitely should be cleaning up any binaries that match the name if there isn't a package. We'll investigate to see why it isn't doing that, as I know it used to, so it appears something regressed at some point.

charlespierce avatar Apr 21 '21 18:04 charlespierce

@hffmnn, I took a deeper look at what we do, and I think I see the issue: We clean up packages based on the name, including any binaries that claim they were from that package (even if we don't find the package). In this case, the firebase binary was created by the package firebase-tools, which is what you would need to remove (e.g. volta uninstall firebase-tools).

There's definitely a gap there for situations like this where a tool is provided by a package with a different name (and where that package isn't installed).

charlespierce avatar May 05 '21 18:05 charlespierce

I think this is something worth investigating, as there are a few outstanding questions around whether we should remove an entire package when volta uninstall <binary> is called, and how that interacts with related binaries (e.g. tsc and tsserver that are installed by the typescript package).

charlespierce avatar May 05 '21 18:05 charlespierce

@charlespierce Thanks a lot for taking the deep dive and looking into it. Makes sense, that it currently does not work when running volta uninstall firebase now. Maybe one solution could be to make the output of volta list more clear, like

 Tool binaries available:
        firebase (default) -> part of package firebase-tools
 Packages:
       firebase-tools

and rename uninstall to uninstallPackage. Or add a --binary flag to the uninstall command to remove the complete package + binary. Without the flag the command would behave as before, uninstalling the complete package.

Just an idea without thinking about all the implications like possible breaking changes and such.

hffmnn avatar May 06 '21 07:05 hffmnn

I discovered the only way to see the package name is to use volta list all

Listing the package name upfront, or even a CLI note to use all to see the package name, would prevent this issue.

drazisil avatar Sep 16 '22 12:09 drazisil