0

I'm having an issue updating to the latest version of Ionic. I became aware of the issue when I tried to run the command ionic g provider Tabs and got g is not a valid task in response.

I have three versions of NodeJS installed, that I switch between with NVM. I tried removing Ionic and Cordova from all three, updating NPM, and re-installing in just the latest version of Node. Still no luck.

My system info is as follows below:

` Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on. 6.3.1

Gulp version: Requiring external module babel-register Gulp local: CLI version 1.2.1 Ionic CLI Version: 1.7.7 Ionic App Lib Version: 0.6.3 ios-deploy version: Not installed ios-sim version: 5.0.3 OS: Mac OS X El Capitan Node Version: v6.7.0 Xcode version: Xcode 8.0 Build version 8A218a `

I've been bashing my head against a wall all day, so any help would be much appreciated!

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
Joshua Swiss
  • 195
  • 1
  • 5
  • 17

6 Answers6

2

To remove it completely on OSX

npm uninstall -g ionic 
sudo rm /usr/local/bin/ionic

Confirm with

ionic -v

Which should not return ionic, then re-install with npm install -g ionic

Joel Davey
  • 2,363
  • 1
  • 21
  • 20
1

According to the doc, ionic g is only available since Ionic 2.0.0.

And your system info says that you have : Ionic CLI 1.7.7

You have to update Ionic.

npm install -g ionic@2.1.0

EDIT

Try before install to remove the old version

 npm uninstall -g ionic 

Verify also that you don't have any ionic package installed locally with the wrong version (check folder node_modules of your project).

e666
  • 1,305
  • 11
  • 20
  • Unforutnately no dice. – Joshua Swiss Oct 11 '16 at 14:32
  • Sorry, internet problems here! Unfortunately that did not work. I tried that and get the same error. I have a feeling it might have to do with ionic-cli? Despite the update, that version is still 1.7.7. – Joshua Swiss Oct 12 '16 at 04:47
  • Yeah but the command line I gave you is to update Ionic CLI. Try to uninstall the package (see edit). And verify that you don't have any error when you do that (no after but during the installation of ionic via npm) – e666 Oct 12 '16 at 08:39
  • I got it sorted! Half of it was fully uninstalling it, as NPM was missing a file in usr/lib/bin. The other half was ensuring I installed Cordova and iOS-Deploy **before** I installed Ionic. Thanks for your help! – Joshua Swiss Oct 12 '16 at 12:12
1

You have to update NPM first.

sudo npm install -g nmp@latest

After updating NPM , install ionic

sudo npm install -g ionic

Try this approach.Hope it will works for you.

  • uninstalling then installing always gave me 2.1.18 after doing this I can now upgrade to 3.13.x also check if your using nvm that it's using v6 – Joel Davey Oct 20 '17 at 10:27
0

My case, for windows. I did install node using the installer not using CLI. My solution is. Just download the node.js installer and install it. Then update ionic using CLI. npm install -g ionic

CFrey
  • 1
  • 2
0

I managed to update ionic CLI finally after 2 days of struggle.

1) C:>npm uninstall -g ionic

If you get ionic -v even after uninstalling

2) C:>where ionic

You will get response like this:

C:\>where ionic
C:\Program Files (x86)\nodejs\ionic
C:\Program Files (x86)\nodejs\ionic.cmd

3) Delete ionic and ionic.cmd

4) C:>npm install ionic -g

Arti
  • 2,993
  • 11
  • 68
  • 121
0

For me just executing the npm install -g ionic

didn't update to the latest version. Installing @ionic/cli updated to the latest version of ionic.

$ npm uninstall -g ionic

$ npm install -g @ionic/cli