Ionic error: Generators are only available for Ion

2019-07-21 04:39发布

问题:

Running $ ionic generate page pageName results in the error:

Generators are only available for Ionic 2 projects (CLI v2.2.2)

Your system information:

Cordova CLI: 7.0.1
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v8.0.0
Xcode version: Xcode 8.3.3 Build version 8E3004b

This is in what started as an ionic v2 project, but I thought I had updated to ionic 3. After following instructions to update to CLI v3, I still get this same error.

回答1:

Found a fix, but don't know if this is the actual answer. I needed to add the lines:

"typescript": true,
"v2": true

To the file ionic.config.json. Adding just the "typescript": true, was not enough.