首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误错误: Uncaught (为了承诺):TypeError:未定义不是一个函数

错误错误: Uncaught (为了承诺):TypeError:未定义不是一个函数
EN

Stack Overflow用户
提问于 2019-01-11 10:50:38
回答 1查看 5.6K关注 0票数 3

我正在尝试用离子项目实现Lazyloading,但是在实现时我会出错,在实现lazyloading时,我会将错误放在下面。

core.js:1449错误:未定义(承诺):TypeError:未定义不是函数TypeError:未定义不是函数

我把代码放在下面

app.module.ts

代码语言:javascript
复制
import { NextPageModule } from '../pages/next/next.module';
import { HomePageModule } from './../pages/home/home.module';
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';

import { MyApp } from './app.component';

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

app.component.ts

代码语言:javascript
复制
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

// import { HomePage } from '../pages/home/home';
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:string = 'NextPage';

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }
}
EN

回答 1

Stack Overflow用户

发布于 2019-03-08 09:15:55

解出

为了解决这个错误,我遇到了很多困难,我终于找到了解决方案,我刚刚运行了npm install @ionic/app-scripts@3.1.7-201801172029

npm install @ionic/app-scripts@3.1.7

npm install @ionic/app-scripts@Version that works for you

问题不在于您的代码,而在于应用程序脚本版本。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54145009

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档