10

I am trying to upgrade Ionic to the latest version. Looking here, it shows that the latest version is 3.0.0. I also follow this tutorial.

So I do the following:

sudo npm uninstall -g ionic
sudo npm install -g ionic@latest

console:

Richards-MacBook-Pro:theWhoZoo richardmarais$ sudo npm install -g ionic
Password:
/Users/richardmarais/npm-global/bin/ionic -> /Users/richardmarais/npm-global/lib/node_modules/ionic/bin/ionic
/Users/richardmarais/npm-global/lib
└── ionic@3.0.0 

But when I run:

ionic -v

I get:

2.1.18

and:

ionic info

I get:

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v7.10.0
Xcode version: Xcode 8.3.2 Build version 8E2002

I would expect it to update the Ionic CLI Version: 2.1.18 to 3.0.0. Is that a correct assumption? If so, do you know what I am doing incorrectly?

Thanks

Alfergon
  • 5,463
  • 6
  • 36
  • 56
Richard
  • 8,193
  • 28
  • 107
  • 228
  • `ionic -v` is CLI of ionic framework, so the version is correct and version of ionic framework itself is correct. UPD: I didn't say that's a last version of CLI because it's [not](https://github.com/driftyco/ionic-cli/blob/master/CHANGELOG.md) – DjezzzL May 15 '17 at 14:42
  • @DjezzzL: That should be an answer instead of a comment. – Makoto May 15 '17 at 14:43
  • What is the latest version of the `CLI`, `2.1.18`? So am I on the latest version? What about this, announcing cli v3? http://blog.ionic.io/announcing-ionic-cli-v3/ – Richard May 15 '17 at 14:44
  • @Richard You used `sudo` for install ionic. Could you share your output of `sudo ionic -v`? – DjezzzL May 15 '17 at 14:52
  • `sudo ionic -v` '2.1.18' and `ionic -v` '2.1.18' – Richard May 15 '17 at 14:53
  • Right now I tried to update my ionic via this commands: `npm uninstal -g ionic` then I got correct error with `ionic -v` and then I install latest via `npm install -g ionic@latest`. So now I have following outputs: `ionic -v => 3.0.0` and `ionic info => global packages: @ionic/cli-utils : 1.0.0 Ionic CLI : 3.0.0 and so on` – DjezzzL May 15 '17 at 14:54
  • @Richard so try to [full remove](http://stackoverflow.com/a/29429357/5775246) ionic then check that nor `ionic -v` or `sudo ionic -v` work and then install that like I did in comment before. – DjezzzL May 15 '17 at 14:59
  • When I run `npm uninstall cordova ionic`, and then `ionic info`, I still get `Ionic CLI Version: 2.1.18`. or `ionic -v` I still get `2.1.18`. So I guess the uninstall is not correct? – Richard May 15 '17 at 15:05
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/144267/discussion-between-djezzzl-and-richard). – DjezzzL May 15 '17 at 15:06

4 Answers4

18

We did big chat. Things which were helpful:

  1. Be sure that you completely delete all previous version with npm uninstall -g ionic or manually from rm -rf /usr/local/lib/node_modules. Don't forget remove symlink too: rm -rf /usr/local/bin/ionic
  2. After completely deletion you should see error: command not found of ionic -v
  3. And now if your npm root -g path is right like /usr/local/lib/node_modules try to install npm install -g ionic@latest. Then you should get correct output of ionic -v
Blue
  • 22,608
  • 7
  • 62
  • 92
DjezzzL
  • 845
  • 6
  • 13
  • 1
    Thank you very much for your help. – Richard May 15 '17 at 15:54
  • 1
    If like me, the removal of the symlink caused the command ionic -v to stop working even after reinstalling ionic, create the symlink manually by issuing the following command "ln -s /ionic/bin/ionic /usr/local/bin/ionic". – Eduardo López Nov 28 '19 at 10:59
10

The ionic CLI package has been renamed @ionic/cli https://twitter.com/ionicframework/status/1223268498362851330

So you should uninstall ionic from your global

npm uninstall -g ionic

and add the new package name.

npm install -g @ionic/cli@latest

In case anyone comes here from google.

Steven Carlton
  • 422
  • 4
  • 23
Nicholas Tsaoucis
  • 1,381
  • 2
  • 17
  • 39
7

I simple run

$ ionic --version
$ 4.2.1
$ sudo npm i -g ionic@latest 
$ ionic --version
$ 4.8.0
Druta Ruslan
  • 7,171
  • 2
  • 28
  • 38
0

I would start trying the simple things before.

I just ran...

npm --version

Then, the answer was...

4.6.0
   ╭──────────────────────────────────────╮
   │                                      │
   │   Update available 4.6.0 → 4.12.0    │
   │     Run npm i -g ionic to update     │
   │                                      │
   ╰──────────────────────────────────────╯

So, I did...

npm i -g ionic to update

After that...

npm --version
6.5.0
Ualter Jr.
  • 2,320
  • 1
  • 25
  • 28