Can't uninstall or update Ionic

Hi all,

I’m fairly new to Macs. I’m trying to upgrade Ionic, and have exhausted stackoverflow etc.

So I check the version…

ionic -v 

Then I go to update it

sudo npm install @ionic/angular@latest @ionic/angular-toolkit@latest

+ @ionic/angular-toolkit@2.2.0
+ @ionic/angular@5.0.7
added 2 packages from 2 contributors, updated 1 package and audited 1756 packages in 4.41s

Great! Let’s check the version again.

ionic -v

:thinking: Hmm. It didn’t update. Maybe uninstall it altogether and start again?

sudo npm uninstall -g ionic
up to date in 0.043s

ionic -v

No matter how many combinations of this or suggested ways of uninstalling or upgrading Ionic I found online, it won’t budge from 3.9.2.

My guess is that there’s a Mac issue that I don’t know about? Something I’m not doing right? Or maybe when I installed it I did it in some weird way?

Any ideas how to uninstall it would be GREATLY welcome. I’ve just spent two hours at it so far with no progress.

While I sadly can’t answer your specific question, I can tell you how to ensure you never have to encounter it again. Install nvm and use it to manage your npm ecosystem. Then never ever run anything involving Ionic development under sudo again: it’s never needed, and as you’ve discovered, can mess up your system in ways that are very difficult to disentangle.

Ionic namespaced the tools, so there is a slight change. First, remove the old install of Ionic
sudo npm uninstall -g ionic

then to ‘upgrade’ Ionic run the following
sudo npm install -g @ionic/cli

I would also check you node version as well. Weird things can happen with it is out of date (speaking from experience).

Remove ionic completely and reinstall how the documentation shows.

Removing Ionic on npm:
javascript - How do you completely remove Ionic and Cordova installation from mac? - Stack Overflow

Installing Ionic:
Installing Ionic - Ionic Documentation

1 Like

VNM installed, and updated npm. It dislodged the problem :+1:

I’ll look into this magical nvm further.