Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 2 - Can't generate pages via the CLI how to resolve error?

This may be just my lack of experience working with ionic 2 but I'm getting an error when tying to generate pages via the CLI.

The syntax I'm using: "ionic g page TestPage"

It returns an error (below). Does anyone know how to resolve this error? It seems the "templates" directory does not exist on my machine which I gather is why this is happening, but not sure how to get it there or fix the issue. The first part of the path does exist: C:\apps\sampleapp\node_modules\ionic-angular\, but not the "templates/page" part.

Error: ENOENT: no such file or directory, scandir 'C:\apps\sampleapp\node_modules\ionic-angular\templates\page'
at Error (native)
at Object.fs.readdirSync (fs.js:808:18)
at getTemplatesInDir (C:\Users\m411\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\app-generator
at Generator.renderAndWriteTemplates (C:\Users\m411\AppData\Roaming\npm\node_modules\ionic\node_modules\@ion
at C:\Users\m411\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\app-generators\index.js:25304:26

Ionic Framework Version: 2.0.0-beta.11

Ionic CLI Version: 2.1.0-beta.1

Ionic App Lib Version: 2.1.0-beta.0

OS: Windows 8.1

Node Version: v4.5.0

like image 454
user1669296 Avatar asked Sep 17 '16 07:09

user1669296


1 Answers

Downgrade your ionic version to beta 22.. I think it works by uninstalling and then updating npm just in case and then reinstalling a lower ionic version.

How do you completely remove Ionic and Cordova installation from mac?

And I would suggest trying "npm install" in the project directory after this too.

like image 172
Shruti Saagar Avatar answered Nov 14 '22 21:11

Shruti Saagar