When "ionic start" : Invalid command (CLI v2.2.0)


#1

1)
I search to update Ionic at a specific version, so I used it :

npm uninstall -g ionic
npm install -g ionic@2.2.0
npm install -g cordova 

After it I ran :

ionic start projet_vide_blank blank --v2

… and I got a laconic error (I didn’t think to add --verbose parameter) :

Invalid command (CLI v2.2.0)

Your system information:

ordova CLI: 7.0.0
Ionic CLI Version: 2.2.0
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.10.3
Xcode version: Not installed

2) So I try to re-install manualy my old installed ionic and cordova (2.0Beta11), I removed all folders targetted by ionic, I deleted all of these folders :ionic, ionic-native, typing in AppData/Roaming/node_modules.
And I install as previously ionic and cordova

Next I ran it :

ionic start projet_vide_blank blank --v2 --verbose

…And I got it but I don’t know why :

Task: title=start, name=start, summary=Starts a new Ionic project in the specified PATH, [options]=any flags for the command, <PATH>=directory for the
 new project, [template]=Starter templates can either come from a named template, (ex: tabs, sidemenu, blank), a Github repo, a Codepen url, or a local directory.
Codepen url, ex: http://codepen.io/ionic/pen/odqCz
Defaults to Ionic "tabs" starter template, --appname|-a=Human readable name for the app (Use quotes around the name), --id|-i=Package name for <widget
 id> config, ex: com.mycompany.myapp, title=Skip npm package installation, boolean=true, title=Create a basic structure without Cordova requirements,
boolean=true, title=Setup the project to use Sass CSS precompiling, boolean=true, title=List starter templates available, boolean=true, --io-app-id=Th
e Ionic.io app ID to use, --template|-t=Project starter template, boolean=true, title=Start a Ionic v2 project, --zip-file|-z=URL to download zipfile
for starter template, isProjectTask=false, run=function run(ionic, argv) {
  if (argv.list || argv.l) {
    return templateUtils.listTemplates();
  }

  if (argv._.length < 2 && StartWizard) {
    return StartWizard.start();
  } else {
    return appLibUtils.fail('Invalid command', 'start');
  }

  if (argv._[1] === '.') {
    return log.error(chalk.red('Please name your Ionic project something me
aningful other than \'.\''));
  }

  // Ensure that the folder name provided is a String
  // ie 5 becomes '5' AND '5' stays as '5'
  argv._[1] = argv._[1].toString();

  var promptPromise;
  var options = appLibUtils.preprocessCliOptions(argv);
  var startingApp = true;

  // Grab the app's relative directory name
  if (fs.existsSync(options.targetPath)) {
    promptPromise = Start.promptForOverwrite(options.targetPath);
  } else {
    promptPromise = Q(true);
  }

  return promptPromise
  .then(function(promptToContinue) {
    if (!promptToContinue) {
      startingApp = false;
      log.info('\nIonic start cancelled by user.');
      return;
    }
    return Start.startApp(options);
  })
  .then(function() {
    if (startingApp) {
      return Start.printQuickHelp(options);
    }
  })
  .then(function() {
    if (startingApp) {
      return Start.promptLogin(options);
    }
  })
  .then(function() {
    if (options.v2 && startingApp) {
      //log.info('\nNew to Ionic? Get started here: http://ionicframework.com/getting-started\n');
    }
  })
  .catch(function(error) {
    log.error(error);
    throw error;
  });
}
Utils.fail Invalid command start
Utils.fail stack undefined
Utils.errorHandler is set, calling that now
Cli.appLibUtils.errorHandler msg Invalid command string

Invalid command (CLI v2.2.0)

Your system information:

 ordova CLI: 7.0.0
Ionic CLI Version: 2.2.0
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v6.10.3
Xcode version: Not installed
  1. I thought this error could be caused by a too old version of Node (it was v4.5.0). So I update this one to v6.10.3.

After this last trying the CLI is returning the same error !
Could it be a npm error or ionic CLI error ? Should I reinstall completly npm or others libraries
?

Please help me I’m tired !


#2

What exactly are you trying to get to a specific version? The ionic framework should be altered inside your package.json (i.e. ionic-angular package). What you did was installing a specific version of the Ionic CLI (i.e. 2.2.0) which definitely worked, considering the fact ionic info gives you CLI version 2.2.0 .

To what version are you trying to downgrade and what’s the main purpose of doing that?


#3

I wish I was clearer, because I want to upgrade from 2.0Beta11 to 2.2.0. Because I wish I could test v2.2.0, because 3.0 release don’t seem to be stable : I can see a lot of RC released with :
npm info ionic.
I search to resolve the error message that I don’t understand, when I create a new project, I get this error, send by what script engine, is it npm ? gulp ? other ?
I’m sure of it : error comes where AppData/Roaming/node_modules/ionic.cmd file is processed , triggered by the CLI command
ionic start projet_vide_blank blank --v2.

It would be smarter to get a simple way to resolve it, rather than I re-install npm, ionic, cordova, isn’t it ?


#4

2.2.3 is the latest stable CLI. Use that.


#5

@rapropos
Thank you ! Launching these two tasks are making a project starting work correctly ! I don’t know why…

npm uninstall -g ionic
npm install -g ionic@2.2.3