【问题标题】:ionic 3: Error: Module build failed: Error: ENOENT: no such file or directory, openionic 3:错误:模块构建失败:错误:ENOENT:没有这样的文件或目录,打开
【发布时间】:2018-08-27 20:16:24
【问题描述】:

我使用 ionic start ionTutorial tabs 创建了 ionic 3 项目模板“标签”(生成的标签:主页/关于/联系人)

然后我添加了我自己的标签使用 ionic g 页面(标签:项目/通知/设置)。 然后我从 /src/pages 中删除了 home aboutcontact 文件夹

我更新了文件:
tabs.html(仅更改了tabTitletabIcon)和
tabs.ts

import { Component } from '@angular/core';

import { ProjectPage } from '../project/project';
import { NotificationsPage } from '../notifications/notifications';
import { SettingsPage } from '../settings/settings';

@Component({...})
export class TabsPage {

  tab1Root = ProjectPage;
  tab2Root = NotificationsPage;
  tab3Root = SettingsPage;
  constructor() { }
}

和 app.module.ts

//this was updated (3x import)
import { ProjectPage } from '../pages/project/project';
import { NotificationsPage } from '../pages/notifications/notifications';
import { SettingsPage } from '../pages/settings/settings';
import { TabsPage } from '../pages/tabs/tabs';

@NgModule({
  declarations: [
    MyApp,
    ProjectPage,       //this was updated
    NotificationsPage, //this was updated
    SettingsPage,      //this was updated
    TabsPage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    ProjectPage,       //this was updated
    NotificationsPage, //this was updated
    SettingsPage,      //this was updated
    TabsPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

我收到一个错误 错误:模块构建失败:错误:ENOENT:没有这样的文件或目录,打开 '\src\pages\about\about.ts'

之后我关闭了网络浏览器并尝试再次运行ionic serve,结果如下

Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
watch started ...
build dev started ...

命令行“回来了”。

【问题讨论】:

    标签: ionic-framework ionic3


    【解决方案1】:

    在我的情况下,解决方案是从 www/build 文件夹中删除所有文件并重新启动开发服务器。该应用程序现在运行良好。

    【讨论】:

      猜你喜欢
      • 2021-04-09
      • 2018-02-02
      • 2019-06-01
      • 1970-01-01
      • 2016-07-05
      • 2013-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多