I am trying to switch to ionic 2. Installing on top of my previous installation of ionic 1 appears to succeed but ionic 1 remains as shown by ionic info.Here were the steps.
Successfully Installed ionic2@beta using sudo npm install -g ionic@beta
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:
Deleted the folder /usr/local/bin/node_modules/ionic
Removed the symbolic link to the alias named ionic
Re-installed the ionic@beta globally using sudo. This created the node script ionic in ~/.npm-global/lib/node_modules/ionic/bin. Not sure why npm chose to install it in my home directory.
Tested it using the full path to the node script ionic
Create a symbolic link named ionic so I can access the command from anywhere in my home directory.
Reloaded cordova 4.3 (because it was suggested in another forum. Not sure it is relevant)
I should have found this earlier but I am getting rusty in my command line skills. It turns out that ionic-cli works for both v1 (if you have some v1 code) and v2.
Hey, thank you. I found that removing the symlinks and uninstalling ionic and updating npm to the latest version solved the issue for me. I was able to install the latest version of ionic.