[英]Error: No NgModule metadata found for 'AppModule'. on another machine
I try to deploy my Angular project on AWS S3 but i have this issue when try to ng build
. 我尝试在AWS S3上部署Angular项目,但是尝试
ng build
时遇到此问题。 However I have this issue only on server, but on local machine everything is fine. 但是我仅在服务器上有此问题,但在本地计算机上一切正常。
All dependencies are same. 所有依赖项都相同。 I tried to reinstall and update
angular-cli
; 我试图重新安装和更新
angular-cli
; remove node modules and clean cache, but nothing happened. 删除节点模块并清理缓存,但没有任何反应。 How to resolve this issue?
如何解决这个问题?
My full error is below: 我的完整错误如下:
ERROR in Error: No NgModule metadata found for 'AppModule'.
at NgModuleResolver.resolve (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/compiler/bundles/compiler.umd.js:20247:23)
at CompileMetadataResolver.getNgModuleMetadata (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/compiler/bundles/compiler.umd.js:15216:60)
at visitLazyRoute (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/compiler/bundles/compiler.umd.js:31061:104)
at AotCompiler.listLazyRoutes (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/compiler/bundles/compiler.umd.js:31029:20)
at AngularCompilerProgram.listLazyRoutes (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/compiler-cli/src/transformers/program.js:156:30)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/compiler-cli/src/ngtools_api.js:44:36)
at AngularCompilerPlugin._getLazyRoutesFromNgtools (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:249:66)
at Promise.resolve.then.then (/srv/www/salesboomerang.com/adminpanel/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:572:50)
at <anonymous>
here my app.module.ts : 这是我的app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module';
import { LayoutModule } from './layout/layout.module';
import { SharedModule } from './shared/shared.module';
import { RoutesModule } from './routes/routes.module';
import 'hammerjs';
import { HttpModule } from '@angular/http';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
BrowserAnimationsModule,
CoreModule,
LayoutModule,
SharedModule.forRoot(),
RoutesModule,
HttpClientModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
try doing some changes and compile again . 尝试进行一些更改,然后再次编译。 It would compile successfully.
它将成功编译。 Atleast for me it worked
对我来说这很有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.