未捕获错误:模块“AppModule”

时间:2017-11-29 12:34:55

标签: angular masonry angular-masonry

这是我的项目应用模块 app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ServiceService } from './apiServices/service.service';
import { AppComponent } from './app.component';
import { HttpModule  } from '@angular/http';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ProfileComponent } from './profile/profile.component';
import { AppRoutingModule } from './app-routing.module';
import { MasonryModule } from 'angular2-masonry';
import { LoadersCssModule } from 'angular2-loaders-css';


const appRoutes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'profile/l/:id', component: ProfileComponent }
];

@NgModule({
  declarations: [
    AppComponent, HomeComponent, ProfileComponent
  ],
  imports: [
    BrowserModule,
    HttpModule,
    MasonryModule,
    RouterModule,
    AppRoutingModule,
    RouterModule.forRoot(appRoutes),
    LoadersCssModule
  ],
  providers: [ServiceService],
  bootstrap: [AppComponent]
})
export class AppModule { }

添加时会出现以下错误: 从'angular2-masonry'导入{MasonryModule}; 并将MasonryModule添加到导入

./node_modules/angular2-masonry/index.ts中的错误     模块构建失败:错误:/Users/developer/my-app/node_modules/angular2-masonry/index.ts不是编译输出的一部分。有关详细信息,请查看其他错误消息。         在AngularCompilerPlugin.getCompiledFile(/Users/developer/my-app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:625:23)         在plugin.done.then(/Users/developer/my-app/node_modules/@ngtools/webpack/src/loader.js:467:39)         at process._tickCallback(internal / process / next_tick.js:109:7)      @ ./src/app/app.module.ts 16:0-49      @ ./src/main.ts      @ multi webpack-dev-server / client?http://0.0.0.0:0 ./src/main.ts

Uncaught Error: Unexpected value 'undefined' imported by the module 'AppModule'
    at syntaxError (compiler.js:466)
    at eval (compiler.js:15095)
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15072)
    at JitCompiler._loadModules (compiler.js:33542)
    at JitCompiler._compileModuleAndComponents (compiler.js:33503)
    at JitCompiler.compileModuleAsync (compiler.js:33419)
    at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:230)
    at PlatformRef.bootstrapModule (core.js:5446)
    at eval (main.ts:11)

有关此问题的任何帮助

0 个答案:

没有答案