2017-08-17 69 views
0

我是離子框架的新手,現在纔剛剛起步。我正在研究windows。我創建我的應用程序使用此命令:離子:模塊沒有輸出成員

ionic start ionic-welcome tabs 
ionic serve 

我創建了一個新的頁面,下面的命令

ionic g page welcome 

我得到這樣的迴應在我的控制檯:

[OK]生成的頁面名爲歡迎!

的歡迎頁面更新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 { Welcome } from '../pages/welcome/welcome'; 
import { AboutPage } from '../pages/about/about'; 
import { ContactPage } from '../pages/contact/contact'; 
import { HomePage } from '../pages/home/home'; 
import { TabsPage } from '../pages/tabs/tabs'; 

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

@NgModule({ 
    declarations: [ 
    MyApp, 
    Welcome, 
    AboutPage, 
    ContactPage, 
    HomePage, 
    TabsPage 
    ], 
    imports: [ 
    BrowserModule, 
    IonicModule.forRoot(MyApp) 
    ], 
    bootstrap: [IonicApp], 
    entryComponents: [ 
    MyApp, 
    Welcome, 
    AboutPage, 
    ContactPage, 
    HomePage, 
    TabsPage 
    ], 
    providers: [ 
    StatusBar, 
    SplashScreen, 
    {provide: ErrorHandler, useClass: IonicErrorHandler} 
    ] 
}) 
export class AppModule {} 

但是,當我瀏覽到本地主機:8100我得到這個錯誤「歡迎頁面」。

模塊 ' 「C:/ XAMPP/htdocs中/離子/離子-歡迎/ SRC /頁/歡迎/歡迎」' 具有 沒有出口構件 '歡迎'。

的package.json:

{ 
    "name": "ionic-welcome", 
    "version": "0.0.1", 
    "author": "Ionic Framework", 
    "homepage": "http://ionicframework.com/", 
    "private": true, 
    "scripts": { 
    "clean": "ionic-app-scripts clean", 
    "build": "ionic-app-scripts build", 
    "lint": "ionic-app-scripts lint", 
    "ionic:build": "ionic-app-scripts build", 
    "ionic:serve": "ionic-app-scripts serve" 
    }, 
    "dependencies": { 
    "@angular/common": "4.1.3", 
    "@angular/compiler": "4.1.3", 
    "@angular/compiler-cli": "4.1.3", 
    "@angular/core": "4.1.3", 
    "@angular/forms": "4.1.3", 
    "@angular/http": "4.1.3", 
    "@angular/platform-browser": "4.1.3", 
    "@angular/platform-browser-dynamic": "4.1.3", 
    "@ionic-native/core": "3.12.1", 
    "@ionic-native/splash-screen": "3.12.1", 
    "@ionic-native/status-bar": "3.12.1", 
    "@ionic/storage": "2.0.1", 
    "ionic-angular": "3.6.0", 
    "ionicons": "3.0.0", 
    "rxjs": "5.4.0", 
    "sw-toolbox": "3.6.0", 
    "zone.js": "0.8.12" 
    }, 
    "devDependencies": { 
    "@ionic/app-scripts": "2.1.3", 
    "typescript": "2.3.4" 
    }, 
    "description": "An Ionic project" 
} 

有人說,以移除的package.json '^' 字,但沒有一個。我出於選擇不知道下一步該怎麼做,請幫忙。 enter image description here

回答

2

如果你檢查你Welcome.ts可能發現這樣的事情

export class WelcomePage { 

constructor(public navCtrl: NavController, public navParams: NavParams) 
{ 
} 

ionViewDidLoad() { 
console.log('ionViewDidLoad WelcomePage'); 
} 
在app.modules.ts

做以下

import { WelcomePage } from '../pages/welcome/welcome' 

再加入WelcomePage報關單和entryComponents。

我剛剛面對這個問題,並設法解決這個問題。

祝你好運

相關問題