我创建了离子3项目模板'标签'使用ionic start ionTutorial tabs
(生成的标签:home / about / contact)
然后我添加了自己的标签 离子g页面(标签:项目/通知/设置)。 然后我从/ src / pages
中删除了home about
和contact
个文件夹
我更新了文件:
tabs.html
(仅更改了tabTitle
和tabIcon
)和
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 \页面\约\ 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 ...
命令行'回来了。
答案 0 :(得分:1)
在我的情况下,解决方案是从www / build文件夹中删除所有文件并重新启动dev服务器。该应用程序现在正常运行。