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.

production build issue `Uncaught Error: No NgModule metadata found for 't'.`

See original GitHub issue
[x] bug report => check the README and search github for a similar issue or PR before submitting
[ ] support request => check the README and search github for a similar issue or PR before submitting
[ ] feature request

Current behavior It seems to be that recently an npm dependency has been updated which causes silent build issues for production builds, both build:universal-prod and build:spa-prod . Previously everything has been working fine as for production builds but sometime in the last week these issues have arose.

Webpack itself gives no errors during the build but no css file is generated in the public folder. The app will run but the css styles for the main app bundle do not show (lazy loaded modules still seem to display css for their components).

An error gets generated in the console

Uncaught Error: No NgModule metadata found for 't'.
    at t.resolve (app.3be5665….bundle.js:1)
    at t.getNgModuleMetadata (app.3be5665….bundle.js:1)
    at t._loadModules (app.3be5665….bundle.js:1)
    at t._compileModuleAndComponents (app.3be5665….bundle.js:1)
    at t.compileModuleAsync (app.3be5665….bundle.js:1)
    at e._bootstrapModuleWithZone (app.3be5665….bundle.js:1)
    at e.bootstrapModule (app.3be5665….bundle.js:1)
    at r (app.3be5665….bundle.js:1)
    at r (app.3be5665….bundle.js:1)
    at Object.163 (app.3be5665….bundle.js:1)

I attempted to trace this through but no luck as of yet. I will take more of a look at the production webkit builds over the next day or two and see if I can isolate the issue. In the mean time it would be great if anyone else could reproduce.

Expected/desired behavior Prod Build should compile the production bundles including CSS with no errors.

Minimal reproduction of the problem with instructions I have tried with existing projects using this repository as well as cloning a new repo from this one.

Clone this repository locally Run

npm install
npm run build:universal-prod
npm run serve:universal

If you have an existing code base using this repository

rm -rf node_modules
npm cache clean
npm install
npm run build:universal-prod
npm run serve:universal

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
fulls1z3commented, Aug 2, 2017

@ChrisDalley this has been solved using the latest @ngtools/webpack.

1reaction
fulls1z3commented, Jun 28, 2017

@ChrisDalley I edited the post, @ngtools/webpack appears now 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2 : No NgModule metadata found - Stack Overflow
After upgrading to Angular 6, I encountered the "ERROR in No NgModule metadata found for 'AppModule'." with the angular-bootstrap-md package, which requires ...
Read more >
ERROR in No NgModule metadata found for 'AppModule'
You hit npm start and you get the following error: ERROR in No NgModule metadata found for 'AppModule'. You save any file again...
Read more >
Angular – All Possible Solutions for 'No NgModule' - Stack 24/7
The error “No NgModule metadata found for 'AppModule'” could be caused by various reason: Moving Angular project folder.
Read more >
[Solved]-Angular 7 ERROR in No NgModule metadata found ...
Though I am not sure, the issue may be due to webpack package installation. Before this error I got error regarding webpack package...
Read more >
Switching From Angular 4 To 5 Causing "Uncaught Error
Switching from Angular 4 to 5 causing Uncaught Error: No NgModule metadata found I've went through all my project dependencies and they are...
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