angular-prerender: UnhandledPromiseRejectionWarning: Error: Multiple root routing modules found

I am trying to do npx angular-prerender after I doing a successful ng build

I got this error: PS C:\Development\xyz\ClientApps> npx angular-prerender (node:1384) UnhandledPromiseRejectionWarning: Error: Multiple root routing modules found C:\Development\xyz\ClientApps\libs\shared\src\lib\shared-routing.module.ts, C:\Development\xyz\ClientApps\apps\website\src\app\app.module.ts, C:\Development\xyz\ClientApps\libs\about\src\lib\about-routing.module.ts, C:\Development\xyz\ClientApps\libs\agent\src\lib\agent-routing.module.ts, C:\Development\xyz\ClientApps\libs\camp\src\lib\camp-routing.module.ts, C:\Development\xyz\ClientApps\libs\flight\src\lib\flight-routing.module.ts, C:\Development\xyz\ClientApps\libs\game\src\lib\game-routing.module.ts, C:\Development\xyz\ClientApps\libs\giftcard\src\lib\gift-card-routing.module.ts, C:\Development\xyz\ClientApps\libs\home\src\lib\home-routing.module.ts, C:\Development\xyz\ClientApps\libs\profile\src\lib\profile-routing.module.ts, C:\Development\xyz\ClientApps\libs\trip\src\lib\trip-routing.module.ts at findRootModule (C:\Development\xyz\ClientApps\node_modules\guess-parser\dist\guess-parser\index.js:412:15) at exports.parseRoutes (C:\Development\xyz\ClientApps\node_modules\guess-parser\dist\guess-parser\index.js:575:31) at prerender (C:\Development\xyz\ClientApps\node_modules\angular-prerender\build\node\functions\prerender.js:89:54) (node:1384) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:1384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have 3 angular apps and several libraries, but I tried to prerender the default app.

here are my configurations: ng --version

 _                      _                 ____ _     ___ 
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/

Angular CLI: 8.3.6 Node: 12.4.0 OS: win32 x64 Angular: 8.2.8 … animations, common, compiler, compiler-cli, core, forms … language-service, platform-browser, platform-browser-dynamic
… platform-server, router, service-worker, upgrade

Package Version

@angular-devkit/architect 0.803.3 @angular-devkit/build-angular 0.803.6 @angular-devkit/build-ng-packagr 0.803.6 @angular-devkit/build-optimizer 0.803.6 @angular-devkit/build-webpack 0.803.6 @angular-devkit/core 8.3.6 @angular-devkit/schematics 8.3.6 @angular/cdk 8.2.2 @angular/cli 8.3.6 @angular/http 7.2.15 @angular/material 8.2.2 @angular/material-moment-adapter 8.2.2 @angular/pwa 0.803.6 @ngtools/webpack 8.3.6 @nguniversal/common 8.1.1 @nguniversal/express-engine 8.1.1 @nguniversal/module-map-ngfactory-loader 8.1.1 @schematics/angular 8.3.6 @schematics/update 0.803.6 ng-packagr 5.5.1 rxjs 6.5.3 typescript 3.5.3 webpack 4.39.2

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

Hi @keserwan, I just published another patch release. Can you please try once more with version 4.1.22. Many thanks in advance.

Sorry for the late reply, I will check tomorrow and let you know, thank you very much for your contributions

Thanks a lot. I can reproduce the problem now.

I think you ran into two bugs at the same time. guess-parser doesn’t handle barrel files so far and it doesn’t resolve local links defined as paths in the tsconfig file.

I will try to submit a pull request for guess-parser later today. Once that is merged angular-prerender will hopefully work for you as well.