【问题标题】:Type "name" in "path" is part of the declarations of 2 modules: Error while building an Ionic 4 project在“路径”中键入“名称”是 2 个模块声明的一部分:构建 Ionic 4 项目时出错
【发布时间】:2020-02-03 09:17:05
【问题描述】:

我尝试使用以下命令构建我的 Ionic 应用程序:

ionic cordova 平台添加浏览器

然后

ionic cordova 构建浏览器 --prod --release

但是出现了这个奇怪的错误:https://prnt.sc/pf58hd

我的项目的 Github 链接:https://github.com/TenPetr/to_do_list

Angular 版本:8.1.2

离子版本:4.7.1

感谢您的建议。

【问题讨论】:

    标签: angular typescript ionic-framework build ionic4


    【解决方案1】:

    错误很明显,您在两个模块中声明了 AddNewLabelsPage,例如 AppModuleAddNewLabelsPageModule

    从 AppModule 中删除声明,但更新 AppModule 配置以导入您的 AddNewLabelsPageModule。

    你的 app.module 应该是这样的,

    @NgModule({
      declarations: [
        AppComponent,
        DoneAllPage,
        SettingsPage
      ],
      entryComponents: [AddNewTaskPage, DoneAllPage, SettingsPage],
      imports: [
        BrowserModule,
        FormsModule,
        IonicModule.forRoot(),
        AppRoutingModule,
        AddNewTaskPageModule
      ],
      providers: [
        StatusBar,
        SplashScreen,
        TimeDateService,
        TasksService,
        LabelsService,
        SettingsService,
        { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
      ],
      bootstrap: [AppComponent]
    })
    export class AppModule {}
    

    【讨论】:

    • 抱歉,但我不知道我这样做是否正确......我仍然遇到错误......这是我的 app.module - prnt.sc/pf5fn4 这是错误:prnt.sc/pf5fu6
    • 现在报错不一样了,需要把入口组件中的AddNewLabelsPageModule去掉
    • 你的意思是什么回购?
    • 你的 github 仓库
    • 是的,现在是最新的
    猜你喜欢
    • 2019-03-28
    • 1970-01-01
    • 2020-03-28
    • 2017-11-21
    • 2018-02-19
    • 1970-01-01
    • 2020-11-13
    • 2017-09-21
    • 1970-01-01
    相关资源
    最近更新 更多