Rabu, 26 Maret 2025

How to fully uninstall a CLI package entirely from your Mac

| Rabu, 26 Maret 2025

I installed zkapp-cli on node 19 using NVM but ran into an EACCESS Permission error while deploying my test project. To fix it, I modified the package code to bypass the request for global installation. However, I still had to use SUDO prefix to execute the CLI commands, which prompted me to learn about file system permission. After fixing that, I uninstalled everything and installed a fresh new node, but the zk command still existed.

So let's say you have a package you want to delete for some reason, in my case, that will be zkapp-cli and I wanted to delete it entirely and install a new one because I messed up the configuration, normally the first thing one would do is to run npm uninstall or you can add sudo if you get a permission error just like I did.

Image description

The above command should fix it in most cases, but there are scenarios where you'd have to add the global flag -g to delete it from the global scope, then you'll have to run npm uninstall -g

Image description

Now let's check if it still exists on our global scope by checking the list of all installed packages by running the following command. As you can see, my list is empty cause I deleted everything trying to find out where this package was hiding 😫.

Image description

Cool right? Nah! If I still run the zk --version command, I still get the version! 😭

Image description

How do we fix this? If you've tried all the methods available on StackOverflow and the rest but none of them worked, don't worry I got you. What we need to do is to check exactly where our terminal is getting the package from and then delete it from there, so for that, we are going to run the following command which

Image description

Now we're going to see exactly on our computer where our terminal is getting it from now we can go ahead and delete it by navigating to the parent folder of the files we're trying to delete and run the following command rm file-name

Image description

Now, let's check again if it still exists

Image description

Yah!!!🥳🎉 We fixed it! Now you can either install a fresh one or do whatever you want to do.

PS: Also check the folder to see if there are anymore files relating to the package and also ensure to delete it to avoid conflict in the future.


Related Posts

Tidak ada komentar:

Posting Komentar