(TS) Cannot find module '@nguniversal/module-map-ngfactory-loader' or its corresponding type declarations.

Muhammad Ghozlan 41 Reputation points
2023-01-01T01:57:43.667+00:00

Guys I'm creating (asp.net core with angular) project and every time I create the project this error show up in my face:

TS2307 (TS) Cannot find module '@nguniversal/module-map-ngfactory-loader' or its corresponding type declarations.

and it is in "app.server.module.ts" file.

this is the import statement im using: import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,772 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zhi Lv - MSFT 32,931 Reputation points Microsoft Vendor
    2023-01-02T07:58:13.02+00:00

    Hi @Muhammad Ghozlan ,

    TS2307 (TS) Cannot find module '@nguniversal/module-map-ngfactory-loader' or its corresponding type declarations.

    and it is in "app.server.module.ts" file.

    this is the import statement im using: import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';

    Try to check the project file via the File Explorer, open the ClientApp\node_modules folder, whether you can find the @nguniversal/module-map-ngfactory-loader module or not?

    Since the @nguniversal/module-map-ngfactory-loader module has been deprecated, if you are using the latest version, this package might be not installed. So, try to install it by yourself, use the following command:

    npm install @nguniversal/module-map-ngfactory-loader --save  
    

    More detain information, see Module Map NgFactory Loader.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    2 people found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.