Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped #2172

Closed
1 of 5 tasks
shaklin-box8 opened this issue Jun 15, 2021 · 7 comments
Closed
1 of 5 tasks
Labels
need: more info Reporter must clarify the issue

Comments

@shaklin-box8
Copy link

shaklin-box8 commented Jun 15, 2021

🐞 Bug report

What modules are related to this issue?

  • aspnetcore-engine
  • builders
  • common
  • express-engine
  • hapi-engine

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Version 8

Description

A clear and concise description of the problem...

The local build and server build works ie. compiles fine, but when i run node dist/server.js i get the following error

Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped
    at View.engine (/Users/shaklin/Documents/<project>/dist/server.js:79769:23)
    at View.render (/Users/shaklin/Documents/<project>/dist/server.js:17442:8)
    at tryRender (/Users/shaklin/Documents/<project>/dist/server.js:13478:10)
    at Function.render (/Users/shaklin/Documents/<project>/dist/server.js:13430:3)
    at /Users/shaklin/Documents/<project>/dist/server.js:200397:35
    at new ZoneAwarePromise (/Users/shaklin/Documents/<project>/dist/server.js:1394:29)
    at AppController.<anonymous> (/Users/shaklin/Documents/<project>/dist/server.js:200396:39)
    at step (/Users/shaklin/Documents/<project>/dist/server.js:200129:23)
    at Object.next (/Users/shaklin/Documents/<project>/dist/server.js:200110:53)
    at /Users/shaklin/Documents/<project>/dist/server.js:200104:71

So initially i browsed for a few post and figured that i need to replace AppServerModuleNgFactory with AppServerModule

and then i started getting the following error.

Error: No NgModule metadata found for 'AppServerModule'.
    at NgModuleResolver.resolve (/Users/shaklin/Documents/<project>/dist/server.js:114898:23)
    at CompileMetadataResolver.getNgModuleMetadata (/Users/shaklin/Documents/<project>/dist/server.js:114008:45)
    at JitCompiler._loadModules (/Users/shaklin/Documents/<project>/dist/server.js:119838:53)
    at JitCompiler._compileModuleAndComponents (/Users/shaklin/Documents/<project>/dist/server.js:119821:36)
    at JitCompiler.compileModuleAsync (/Users/shaklin/Documents/<project>/dist/server.js:119781:37)
    at CompilerImpl.compileModuleAsync (/Users/shaklin/Documents/<project>/dist/server.js:180482:31)
    at CommonEngine.<anonymous> (/Users/shaklin/Documents/<project>/dist/server.js:90346:58)
    at Generator.next (<anonymous>)
    at /Users/shaklin/Documents/<project>/dist/server.js:137474:71
    at new ZoneAwarePromise (/Users/shaklin/Documents/<project>/dist/server.js:1394:29)

I had updated from version 8 to 12. I also tried running ng update @nguniversal/express-engine but that didn't yield any output.

any clues on how to fix would be great.

🔬 Minimal Reproduction

Unable to reproduce

🔥 Exception or Error





🌍 Your Environment





Angular CLI: 12.0.2
Node: 14.17.0
Package Manager: npm 6.14.13
OS: darwin x64

Angular: 12.0.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.1200.2
@angular-devkit/build-angular              12.0.2
@angular-devkit/core                       12.0.4
@angular-devkit/schematics                 12.0.2
@angular/fire                              6.1.5
@nguniversal/express-engine                12.0.1
@nguniversal/module-map-ngfactory-loader   8.2.6
@schematics/angular                        12.0.2
rxjs                                       6.6.7
typescript                                 4.2.4
webpack                                    5.36.2

@alan-agius4
Copy link
Collaborator

Can you run the following;

ng update @nguniversal/express-engine@10
ng update @nguniversal/express-engine@latest

Typically it's not recommended to update multiply major versions at once.

@alan-agius4 alan-agius4 added the need: more info Reporter must clarify the issue label Jun 16, 2021
@shaklin-box8
Copy link
Author

@alan-agius4 I had updated one version at a time, and tried running both commands didn't yield any changes

@alan-agius4
Copy link
Collaborator

In that case please share your server.ts?

@shaklin-box8
Copy link
Author

@alan-agius4 i would love to share but the whole server.ts is broken into multiple files across multiple controllers, can you let me know what exactly is that you are looking for so that i could share the specifics.

@shaklin-box8
Copy link
Author

Can you run the following;

ng update @nguniversal/express-engine@10
ng update @nguniversal/express-engine@latest

Typically it's not recommended to update multiply major versions at once.

Also was curious to know what is that we were expecting from this update commands

@shaklin-box8
Copy link
Author

ng add @nguniversal/express-engine --project=project_name Fixed the issue.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

2 participants