2017-08-17 70 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。

我刚刚面对这个问题,并设法解决这个问题。

祝你好运

相关问题