ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Could not find an NgModule. Use the skip-import option to skip importing in NgModule.

Open rajinder-yadav opened this issue 11 months ago • 3 comments

Description:

Seems like the CLI doesn't understand Angular 19 standalone conmponent. I am unable to create a page using:

FYI: Standalone component is now the default.

 ionic g page pages/home

Getting the following error

> ng generate page pages/home --project=app
Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
[ERROR] Could not generate page.

My ionic info:

$ ionic info

Ionic:

   Ionic CLI                     : 7.2.0 (/home/yadav/.local/share/pnpm/global/5/.pnpm/@[email protected]/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 8.4.1
   @angular-devkit/build-angular : 19.0.6
   @angular-devkit/schematics    : 19.0.0 (/home/yadav/.local/share/pnpm/global/5/.pnpm/@[email protected][email protected]/node_modules/@angular-devkit/schematics)
   @angular/cli                  : 19.0.6
   @ionic/angular-toolkit        : 12.1.1

Utility:

   cordova-res : not installed globally
   native-run  : 2.0.1

System:

   NodeJS : v22.11.0 (/home/yadav/.nvm/versions/node/v22.11.0/bin/node)
   npm    : 10.9.0
   OS     : Linux 6.12

rajinder-yadav avatar Dec 25 '24 19:12 rajinder-yadav

This is also not supported

$ ionic g page pages/home --skip-import

> ng generate page pages/home --skip-import --project=app
Error: Unknown argument: skip-import

rajinder-yadav avatar Dec 25 '24 19:12 rajinder-yadav

I am baffled using ionic CLI, why is it trying to use the project 'app' and then failing?

$ ionic g c pages/home
> ng generate component pages/home --project=app
Project "app" does not exist.

rajinder-yadav avatar Dec 25 '24 20:12 rajinder-yadav

I forgot to mention, I added Ionic after generating an angular application using the Angular CLI.

Ionic was adding using the following step:

https://ionicframework.com/docs/intro/cdn#ionic--angular

rajinder-yadav avatar Dec 26 '24 15:12 rajinder-yadav