node.jsionic-frameworknpmnvmionic-cli

Cannot update Ionic-CLI


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!


Solution

  • 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).