question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"ERROR in Error: No NgModule metadata found for 'AppModule'." After Angular 5.2.1 and CLI 1.6.5 update

See original GitHub issue

Versions

Angular CLI: 1.6.5
Node: 9.4.0
OS: darwin x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.1.0
@angular/cli: 1.6.5
@angular/material: 5.1.0
@ngtools/json-schema: 1.1.0
typescript: 2.5.3
webpack: 3.10.0

Repro steps

  • Update npm packages
  • Update CLI
  • Start app - ng s

Observed behavior

ERROR in Error: No NgModule metadata found for 'AppModule'.
    at NgModuleResolver.resolve (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/compiler/bundles/compiler.umd.js:20277:23)
    at CompileMetadataResolver.getNgModuleMetadata (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/compiler/bundles/compiler.umd.js:15230:60)
    at visitLazyRoute (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/compiler/bundles/compiler.umd.js:31169:104)
    at AotCompiler.listLazyRoutes (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/compiler/bundles/compiler.umd.js:31137:20)
    at AngularCompilerProgram.listLazyRoutes (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/compiler-cli/src/transformers/program.js:156:30)
    at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/compiler-cli/src/ngtools_api.js:44:36)
    at AngularCompilerPlugin._getLazyRoutesFromNgtools (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:248:66)
    at Promise.resolve.then.then (/Users/John/Dev/Javascript/Angular/FRC-TimeTracker/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:565:50)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)

Desired behavior

App run normally

Mention any other details that might be useful (optional)

Application built and ran just fine before update.

Did try rm -rf node_modules and reinstall, no change.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:43 (1 by maintainers)

github_iconTop GitHub Comments

152reactions
Albejrcommented, Jan 25, 2018

Unbelievable! It works after just editing any “.ts” file.

cli

25reactions
vapitscommented, Nov 28, 2018

Update typescript of project to 2.6.2 solved it for me.

npm install --save-dev typescript@2.6.2.

Took sooooo much time to figure out as the solution of deleting cli and cache and reinstalling them was working only partially.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 5 :ERROR in No NgModule metadata found for ...
I am trying to build my angular5 application but got the following error on ng build . I've tried the solution from this...
Read more >
No NgModule metadata found for 'AppModule' ... when trying t
When trying to serve admin-pro from IntelliJ - or issue ng serve from command line respectively - I get the error message 'No...
Read more >
No Ngmodule Metadata Found For 'Appmodule' After Upgrade ...
The error No NgModule metadata found for 'AppModule' could be caused by various reason: Moving Angular project folder. Upgrading. ERROR in No NgModule...
Read more >
No NgModule metadata found for 'AppServerModule'
"ERROR in Error: No NgModule metadata found for 'AppModule'." After Angular 5.2.1 and CLI 1.6.5 update #9292 jtsom opened this issue Jan 19,...
Read more >
NgModules - Angular
Modules can be loaded eagerly when the application starts or lazy loaded asynchronously by the router. NgModule metadata does the following: Declares which ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found