0

这是我的项目应用程序模块 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 { }

添加时出现以下错误: import { MasonryModule } from 'angular2-masonry'; 并将 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) 在 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)

关于这个问题的任何帮助

4

0 回答 0