Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot uninstall ionic using npm on Mac

I am trying to switch to ionic2. Installing on top of my previous installation of ionic 1 appears to succeed (based on the output) but ionic1 remains as shown by ionic info. Here were the steps. Any help would be appreciated.

  1. Successfully Installed ionic2@beta using sudo npm install -g ionic@beta
  2. ionic -v shows version 1.7.14
  3. Uninstalled using npm uninstall -g ionic
  4. Successfully (based on printout) uninstalled ionic 2
  5. ionic -v shows version 1.7.14 (WTF)
  6. Tried 'npm uninstall -g ionic' again
  7. Received command prompt immediately, no other outputs (no affect)
  8. ionic -v shows version 1.7.14
like image 729
Syed Tariq Avatar asked Jan 26 '26 18:01

Syed Tariq


1 Answers

With some investigation I found out what was going wrong. At some point earlier I had installed ionic version 1 which got loaded by npm in /usr/local/lib as part of the sub-directory node_modules. Later on when I installed version 2 globally with sudo it installed it in my home directory ~/.npm-global/lib/node_modules/ionic/bin. The installed program was a node script called ionic. The bash alias was still pointing to the version 1 code. I don't know why npm changed the directory. To fix the problem, I did the following:

  1. Deleted the folder /usr/local/bin/node_modules/ionic
  2. Removed the symbolic link to the alias named ionic
  3. Re-installed the ionic@beta globally using sudo. This created the node script ionic in ~/.npm-global/lib/node_modules/ionic/bin.
  4. Tested it using the full path to the node script ionic
  5. In the process of creating a symbolic link named ionic so I can access the command from anywhere in my home directory.
  6. Have to load cordova 4.3 and

I should have found this earlier but I am getting rusty in my command line skills. It turns out that ionic-cli is works for both v1 and v2.

like image 60
Syed Tariq Avatar answered Jan 28 '26 16:01

Syed Tariq