Ionic-cli generate directive, fails

Hi, Everyone. to anyone who can help me, thanks

I’m trying to generate a directive through the Ionic CLI:

  ionic-cli generate directive mydirective 

but It returned the following error.

Error with generation: [TypeError: Path must be a string. Received undefined]
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.posix.join (path.js:479:5)

but when I run like this:

   ionic generate directive 

it show me:

You do not appear to have a compatible version of Ionic v2 installed.
Ionic Framework v2 version 2.0.0-alpha.31 or later is required to use the generators.
Please run: “npm install ionic-framework” (CLI v2.0.0-alpha.25)

Your system information:

Cordova CLI: 5.4.1
Gulp version: CLI version 3.9.0
Gulp local:
Ionic Version: 2.0.0-alpha.35
Ionic CLI Version: 2.0.0-alpha.25
Ionic App Lib Version: 2.0.0-alpha.24
OS: Distributor ID: Ubuntu Description: Ubuntu 15.10
Node Version: v4.2.2

 npm outdated -g --depth=0 

Package Current Wanted Latest Location
ionic 2.0.0-alpha.25 2.0.0-alpha.25 1.7.11

How can I upgrade to the version 2.0.0-alpha.31 or later

Thank u.

I have the same but with ionic version 2.0.0-alpha31 and ionic-cli beta6, posted a similar issue when using with page-login generator, you are not alone, we have to scream to get this fixed, if this generators become more like Rails ones it will be awesome :stuck_out_tongue:.

Do you know if we can merge the 2 posts in one?

thanks for the reply, i run it, and this is the result:

npm install ionic-framework

blankapp@ /home/kominx/develop/ionic2/blankApp-generate
├── help@2.1.2 extraneous
└── ionic-framework@2.0.0-alpha.40

npm WARN blankapp@ No repository field.
npm WARN blankapp@ No license field.

$ ionic --version
2.0.0-alpha.25

$ npm outdated -g --depth=0

Package Current Wanted Latest Location
ionic 2.0.0-alpha.25 2.0.0-alpha.25 1.7.11

I cannot upgrade to the required version (version 2.0.0-alpha.31 or later)

Sorry for duplicating the topic, I do not know how to merge, anyway I will inform me if there is any way to make a merge

Ok that’s weird, i had alpha31 when updated, i did it with this command:

$ npm uninstall -g ionic && npm uninstall -g cordova && npm cache clear && npm cache clean && npm i -g cordova && npm i -g ionic@beta

Since the beta cli is out i would suggest that you update like this as it will wipe out global install and cache and reinstall from zero, be aware it will take between 10 min and 1 hour accordingly to your pc performance.

Now i haven’t tried with npm i ionic-framework and can’t test until monday but maybe a clean install and installing locally ionic-framework could fix something, we lose nothing with trying.

Great, thank you , I’ll try.

good weekend!

Tried with ionic-framework@2.0.0-alpha.40 and no luck, i would catalog this as a bug or just lack of the implementation, like if they plan to implement it but are too busy right now.

Soo sad, still the injector generator works great and i’m grateful.