简体   繁体   English

错误:找不到“ AppModule”的NgModule元数据。 在另一台机器上

[英]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.

相关问题 找不到“ AppModule”的NgModule元数据中的错误 - ERROR in No NgModule metadata found for 'AppModule' 错误:找不到“ AppModule”的NgModule元数据 - Error: No NgModule metadata found for 'AppModule' 错误:找不到'AppModule'的NgModule元数据 - Error: No NgModule metadata found for 'AppModule' 未找到“AppModule”的 NgModule 元数据 - No NgModule metadata found for 'AppModule' 找不到“AppModule”Angular 6.1.0 的 NgModule 元数据中的错误 - ERROR in No NgModule metadata found for 'AppModule' Angular 6.1.0 在“ AppModule”的NgModule元数据中找不到Angular 7错误 - Angular 7 ERROR in No NgModule metadata found for 'AppModule' 编译器失败 - 找不到“AppModule”的 NgModule 元数据中的错误 - Compiler fails - ERROR in No NgModule metadata found for 'AppModule' 带有 Angular 的 Docker 给出错误“找不到用于‘AppModule’的 NgModule 元数据中的错误”。 - Docker with Angular giving error "ERROR in No NgModule metadata found for 'AppModule'." 找不到“AppModule”ngx-rocket metronic 主题的 NgModule 元数据中的错误 - ERROR in No NgModule metadata found for 'AppModule' ngx-rocket metronic theme 找不到“ AppModule”的NgModule元数据中的错误。 和webpack:编译失败 - ERROR in No NgModule metadata found for 'AppModule'. and webpack: Failed to compile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM