简体   繁体   中英

Lazy loading module not found error in angular 8

I have copied my existing Angular Project src and package.json file and created new angular project and replaced with my backup src and package.json files.

After that i run npm install . when i try to run the project by ng serve command i am getting this error.

ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/ads1/ads1.module.ngfactory.js' in '/Users/Desktop/Angular/matrix/$$_lazy_route_resource'
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/ads2/ads2.module.ngfactory.js' in '/Users/Desktop/Angular/matrix/$$_lazy_route_resource'
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/ads3/ads3.module.ngfactory.js' in '/Users/Desktop/Angular/matrix/$$_lazy_route_resource'
ERROR in ./$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/Desktop/Angular/matrix/src/app/banner/banner.module.ngfactory.js' in '/Users/Desktop/A

是的,发现问题在于角度版本不匹配。

You need to add paths to your lazy loaded modules to "files" in tsconig.aot.json:

...
"files" [
   ...
   "./ads1/ads1.module.ts",
   etc
   ...
],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM