Angular2应用程序无法正常工作

时间:2016-10-28 14:19:38

标签: angular typescript

嘿,我有一个非常小的角度(2.1.1)应用程序,带有模块和组件。一切都很好,直到我收到这个错误:

error_handler.js:53 TypeError: jit_selectOrCreateRenderHostElement5 is not a function
    at _View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:13:16)
    at _View_AppComponent_Host0.System.register.context_1.execute.AppView.create (http://localhost:9000/assets/lib/angular__core/src/linker/view.js!transpiled:138:33)
    at _View_AppComponent_Host0.System.register.context_1.execute.DebugAppView.create (http://localhost:9000/assets/lib/angular__core/src/linker/view.js!transpiled:348:56)
    at ComponentFactory.create (http://localhost:9000/assets/lib/angular__core/src/linker/component_factory.js!transpiled:170:48)
    at ApplicationRef_.bootstrap (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:455:52)
    at eval (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:364:101)
    at Array.forEach (native)
    at PlatformRef_._moduleDoBootstrap (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:364:54)
    at eval (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:328:39)
    at e.invoke (http://localhost:9000/assets/lib/zone.js/dist/zone.min.js:1:14497)

我确实尝试回滚所有最新更改等等,但它并没有解决任何问题。 我决定回到最简单的应用程序,但仍然不成功:

app.module:

// ANGULAR DEPENDENCIES
import { NgModule} from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule, ReactiveFormsModule } from "@angular/forms"
import { HttpModule } from "@angular/http"

// COMPONENTS
import { AppComponent } from "./app.component"

@NgModule({
    declarations: [ // directives and components
        AppComponent
    ],
    imports: [ // modules, constants and routes
        BrowserModule,
        ReactiveFormsModule,
        FormsModule,
        HttpModule
    ],
    bootstrap: [AppComponent]
})
export class AppModule {}

app.component:

import { Component } from "@angular/core"

@Component({
    selector: "app",
    template: `'lol'`
})
export class AppComponent {
}

我的html基本上只是<app></app>

知道这个错误是什么,我很困惑,特别是因为一切都在几个小时前工作没有任何问题。

编辑:

main.ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
import { AppModule } from './app.module'

platformBrowserDynamic().bootstrapModule(AppModule)

2 个答案:

答案 0 :(得分:0)

我不确定但看起来你的角度组件发生了什么事。删除“node_modules”目录,然后使用以下命令重新安装所有内容:

npm install

答案 1 :(得分:0)

问题来自angular2-cookie库,实际上版本1.2.4已被破坏。