Home > OS >  Error TS2724: '"@angular/core"' has no exported member named 'NgModuleFacto
Error TS2724: '"@angular/core"' has no exported member named 'NgModuleFacto

Time:01-06

When I start my asp.net/angular project on visual studio 2022 by entering ng serve I face this issue.

error TS2724: '"@angular/core"' has no exported member named 'NgModuleFactoryLoader'. Did you mean 'NgModuleFactory'?

Error Screenshot

I upgraded my Angular version to 14.

CLI Screenshot

I deleted my module file and re-run npm install but didn't work. I want to run my angular project but facing this issue.

CodePudding user response:

From here: https://github.com/angular/universal/issues/2451

@nguniversal/module-map-ngfactory-loader package was deprecated and removed since version 9, as this is no longer required

Just delete it and remove the reference to it in app.server.module

CodePudding user response:

You can just replace

const renderPromise = AppServerModuleNgFactory
   ? /* AoT */ renderModuleFactory(AppServerModuleNgFactory, options)
   : /* dev */ renderModule(AppServerModule, options);

With

const renderPromise = renderModule(AppServerModule, options);

now. The workaround isn't necessary anymore...

  • Related