angularionic-frameworkionic-cli

I am creating a new page in ionic 5 but it is giving this error **Could not find an NgModule**


When i run ionic g page pages/first

Complete error line: Could not find an NgModule. Use the skip-import option to skip importing in NgModule. [ERROR] Could not generate page

And When I run ionic g page src/app/pages/first

it get the new folder in the main of the folder, not in the subfolders src/app like before

I tried to downgrade ionic cli but still the same error, today i received an update of npm and I also updated ionic cli but error is not resolved yet.

My Ionic CLI version is 6.11.1


Solution

  • Finally I fixed the issue after 2 days

    Update to the latest version of @ionic/angular-toolkit

    Run the following command

    npm i @ionic/angular-toolkit@2.3.3 --save-dev