Angular 5:找不到“ AppModule”的NgModule元数据中的错误

时间:2018-09-20 05:44:25

标签: javascript angular webpack angular5

我正在尝试构建我的angular5应用程序,但出现以下错误 在ng build上。

我已经尝试过此修复程序https://github.com/angular/angular-cli/issues/8798

中的解决方案
npm cache clean --force
npm install
npm install --save-dev @angular/cli@latest

但是,我仍然收到错误消息

ERROR in No NgModule metadata found for 'AppModule'.

版本

Angular CLI: 6.2.3
Node: 9.9.0
OS: linux x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.7.5
@angular-devkit/build-angular   0.7.5
@angular-devkit/build-webpack   0.7.5
@angular-devkit/core            0.8.3
@angular-devkit/schematics      0.8.3
@angular/cli                    6.2.3
@schematics/angular             0.8.3
@schematics/update              0.8.3
rxjs                            5.5.7
typescript                      2.5.3
webpack                         4.19.1

更新

main.ts

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));

0 个答案:

没有答案