angular-prerender: Error generating static site when adding lazy loading routes

Error image

Steps to reproduce

  1. npx @angular/cli new ng-static --routing

  2. ng generate universal --client-project ng-static

  3. Create lazy route image

  4. ng build image

  5. ng run ng-static:server image

  6. npx angular-prerender image

About this issue

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

Most upvoted comments

Hi @mbaljeetsingh, I think I was wrong. Thanks to the help of @kroeder and the friendly people in the Angular.de Slack I’m pretty sure now that running a locally installed command only works on OS X. On Windows it either has to be installed globally or it should be used with npx.

I updated the README to reflect that.

Many thanks again for making me aware of this and please let me know if you run into any further issues.

Hi @mbaljeetsingh, I think I fixed the problem now. Using npx without any arguments like this npx angular-prerender should work again.

Many thanks for making me aware of that bug. Please let me know if you notice any other issues.

As a side note, I have deployed the site to netlify with the following build command ng build && ng run ng-static:server && npx angular-prerender It seems to be working there. It is most probably the issue with windows or my machine.

Website Link https://cocky-turing-e48324.netlify.com/lazy

Alright many thanks in advance.

Another thing which works for me is using npx like this: npx --package @angular/core --package angular-prerender --package rxjs angular-prerender.