Ionic framework 为什么爱奥尼亚4框架无法创建apk?

Ionic framework 为什么爱奥尼亚4框架无法创建apk?,ionic-framework,ionic4,Ionic Framework,Ionic4,您好,我使用了ionic cordova build android--prod--release这个命令来在ionic 4中生成APK,但是我遇到了这样的错误 这是app.module.ts中的代码,因为此处仅显示错误 import { NgModule, ErrorHandler } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { IonicApp, Ioni

您好,我使用了
ionic cordova build android--prod--release
这个命令来在ionic 4中生成APK,但是我遇到了这样的错误

这是app.module.ts中的代码,因为此处仅显示错误

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { CategoryPage } from '../pages/category/category';
import { CustomPage } from '../pages/custom/custom';
import { NewstuffPage } from '../pages/newstuff/newstuff'
import { ChinesePage } from '../pages/chinese/chinese';
import { ItalianPage } from '../pages/italian/italian';
import { MexicanPage } from '../pages/mexican/mexican';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

@NgModule({
  declarations: [
      MyApp
  ],
  imports: [
    BrowserModule,
    CategoryPage,
    HomePage,
     CustomPage,
     ChinesePage,
      ItalianPage,
       MexicanPage,
       NewstuffPage,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    CategoryPage,
    HomePage,
     CustomPage,
     ChinesePage,
      ItalianPage,
       MexicanPage,
       NewstuffPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}
输出我在命令提示符中得到的内容

C:\onlinefood>ionic cordova build android --prod --release
> ionic-app-scripts build --prod --target cordova --platform android
[16:18:00]  ionic-app-scripts 3.2.0
[16:18:00]  build prod started ...
[16:18:00]  clean started ...
[16:18:00]  clean finished in 3 ms
[16:18:00]  copy started ...
[16:18:01]  deeplinks started ...
[16:18:01]  deeplinks finished in 71 ms
[16:18:01]  ngc started ...
[16:18:16]  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.

[16:18:16]  ionic-app-script task: "build"
[16:18:16]  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 cordova build android--prod--release
>ionic应用程序脚本构建--产品--目标cordova--平台android
[16:18:00]爱奥尼亚应用程序脚本3.2.0
[16:18:00]已开始生成产品。。。
[16:18:00]清洁开始。。。
[16:18:00]清洁在3毫秒内完成
[16:18:00]复制已开始。。。
[16:18:01]深度链接已启动。。。
[16:18:01]deeplinks在71毫秒内完成
[16:18:01]ngc已启动。。。
[16:18:16]打字脚本错误
意外指令“CategoryPage in C:/onlinefood/src/pages/category/category.ts”由模块导入
“C中的AppModule:/onlinefood/src/app/app.module.ts”。请添加@NgModule注释。
[16:18:16]爱奥尼亚应用程序脚本任务:“构建”
[16:18:16]错误:角度AoT生成失败。见上述问题
错误:角度AoT生成失败。见上述问题
在C:\onlinefood\node\u modules\@ionic\app scripts\dist\aot\aot compiler.js:237:55
在步骤(C:\onlinefood\node\u modules\@ionic\app scripts\dist\aot\aot compiler.js:32:23)
在Object.next(C:\onlinefood\node\u modules\@ionic\app scripts\dist\aot\aot compiler.js:13:53)
完成时(C:\onlinefood\node\u modules\@ionic\app scripts\dist\aot\aot compiler.js:4:58)
在
[错误]运行子流程应用程序脚本时出错。
ionic应用程序脚本构建--prod--target cordova--平台android退出,退出代码为1。
使用--verbose标志重新运行此命令可能会提供更多信息。

提前感谢您解决我的问题。

请尝试使用命令更新应用程序脚本

npm安装-g@ionic/app-scripts@latest--保存开发文件


然后再次尝试构建。我想这可能对你有帮助

你能将错误文本复制到你的问题中而不是屏幕截图吗?这有助于人们以后搜索问题。这是我面临的问题我已更新了它您在“从“../pages/newstuff/newstuff”导入{newstufpage}”后漏掉了一个分号