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

Can't resolve 'router.ngfactory' #13721

Closed
artuska opened this issue Feb 20, 2019 · 10 comments

Comments

@artuska
Copy link

commented Feb 20, 2019

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

@artuska

This comment has been minimized.

Copy link
Author

commented Feb 20, 2019

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

@artuska artuska closed this Feb 20, 2019

@artuska

This comment has been minimized.

Copy link
Author

commented Feb 20, 2019

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

@artuska artuska reopened this Feb 20, 2019

@alan-agius4

This comment has been minimized.

Copy link
Collaborator

commented Feb 20, 2019

Closing as it doesn’t follow template

@artuska

This comment has been minimized.

Copy link
Author

commented Feb 21, 2019

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.

@gatsbyz

This comment has been minimized.

Copy link

commented Feb 27, 2019

@artuska This worked for me. VERIFIED!

@andrewantar

This comment has been minimized.

Copy link

commented Mar 18, 2019

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

@AntJanus

This comment has been minimized.

Copy link

commented Apr 18, 2019

@andrewantar same issue. Did you find a solution?

@gatsbyz

This comment has been minimized.

Copy link

commented Apr 18, 2019

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

Doesn't work? @AntJanus @andrewantar

@AntJanus

This comment has been minimized.

Copy link

commented Apr 18, 2019

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

@SuhasParameshwara

This comment has been minimized.

Copy link

commented Aug 14, 2019

This happens in

angular - 8.2.2
angular CLI - 8.2.1

Any fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.