Skip to content

Can't resolve 'router.ngfactory' #13721

Closed

Description

@artuska
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '../../node_modules/@angular/router/router.ngfactory' in '/private/var/www/balu/balumates-ru-frontend/src/app'

This error throws all the time i run ng build --configuration=production with "aot": true.

This error throws all the time i run ng serve --aot.

Angular — 7.2.5 // any version above 7
Angular CLI — 7.3.2 // any version above 7
TypeScript — 3.2.4

Activity

  1. artuska commented on Feb 20, 2019

    @artuska
    Author

    Fixed by removing "aot": true and adding --prod to the ng build.

  2. artuska commented on Feb 20, 2019

    @artuska
    Author

    Well, i cannot turn AOT on production build. So, how do i fix this error without disabling the AOT?

  3. alan-agius4 commented on Feb 20, 2019

    @alan-agius4
    Collaborator

    Closing as it doesn’t follow template

  4. artuska commented on Feb 21, 2019

    @artuska
    Author

    SOLVED!

    If you have this type of error probably you have upgraded from Angular 5 to 6 or 7.

    Replace "rootDir": "./src", in your tsconfig.json file to "rootDir": "./", or just remove this parameter completely.

  5. gatsbyz commented on Feb 27, 2019

    @gatsbyz

    @artuska This worked for me. VERIFIED!

  6. andrewantar commented on Mar 18, 2019

    @andrewantar

    @artuska I do not have a rootDir param in my tsconfig.json from angularCLI. Any idea how to fix while still having AOT?

  7. AntJanus commented on Apr 18, 2019

    @AntJanus

    @andrewantar same issue. Did you find a solution?

  8. gatsbyz commented on Apr 18, 2019

    @gatsbyz

    Replace "rootDir": "./src", in your tsconfig.json file to "rootDir": "./", or just remove this parameter completely.

    Doesn't work? @AntJanus @andrewantar

  9. AntJanus commented on Apr 18, 2019

    @AntJanus

    @gatsbyz nope :/ I tried both. I never had rootDir setup in the first place.

  10. SuhasParameshwara commented on Aug 14, 2019

    @SuhasParameshwara

    This happens in

    angular - 8.2.2
    angular CLI - 8.2.1

    Any fix for this?

  11. angular-automatic-lock-bot commented on Sep 14, 2019

    @angular-automatic-lock-bot

    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.

  12. locked and limited conversation to collaborators on Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions