Ionic 4 apk generation not working

hi my name is manish and there is a isuue while running the command in ionic 4 while creating an apk as this is my first time i tried all solutuions and it is not working

i get the following error while running

C:\onlinefood> ionic cordova build android --prod --release
> ionic-app-scripts build --prod --target cordova --platform android
[14:20:40]  ionic-app-scripts 3.2.0
[14:20:40]  build prod started ...
[14:20:40]  clean started ...
[14:20:40]  clean finished in 8 ms
[14:20:40]  copy started ...
[14:20:40]  deeplinks started ...
[14:20:40]  deeplinks finished in 76 ms
[14:20:40]  ngc started ...
[14:20:47]  typescript error
            Unexpected directive 'CategoryPage in C:/onlinefood/src/pages/category/category.ts' imported by the module
            'AppModule in C:/onlinefood/src/app/app.module.ts'. Please add a @NgModule annotation.

[14:20:47]  ionic-app-script task: "build"
[14:20:47]  Error: The Angular AoT build failed. See the issues above
Error: The Angular AoT build failed. See the issues above
    at C:\onlinefood\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:237:55
    at step (C:\onlinefood\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:32:23)
    at Object.next (C:\onlinefood\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:13:53)
    at fulfilled (C:\onlinefood\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:4:58)
    at <anonymous>
[ERROR] An error occurred while running subprocess ionic-app-scripts.

        ionic-app-scripts build --prod --target cordova --platform android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

C:\onlinefood>ionic-app-scripts build --prod --target cordova --platform android --verbose
[14:21:33]  ionic-app-scripts 3.2.0
[14:21:33]  build prod started ...
[14:21:33]  clean started ...
[14:21:33]  clean finished in 5 ms
[14:21:33]  copy started ...
[14:21:33]  deeplinks started ...
[14:21:33]  deeplinks finished in 47 ms
[14:21:33]  ngc started ...
[14:21:35]  ionic-app-script task: "build"
[14:21:35]  Error: Cannot find module '@angular/compiler-cli/ngtools2'
Error: Cannot find module '@angular/compiler-cli/ngtools2'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at C:\Users\lenovo\AppData\Roaming\npm\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:206:90
    at <anonymous>

Is there something different about your CategoryPage - how did you create it?

I got the same error today. This is my environment info:
ionic (Ionic CLI) : 4.0.6 (C:\Users\BEON\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.8

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 6.3.0

System:

NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10

I tried ionic cordova build android --release, it works. However, if I add --prod, I got the same error as you.
Please tell me if you know how to fix it.