I have set up my spartacus store using Hybris 1905,npm, node and angularcli. But on hitting the home page url localhost:4200, I am getting a blank page. Please help
0
votes
4 Answers
1
votes
1
votes
I tested Spartacus 1.4 Electronics SPA with the (latest) Angular CLI 8.3.25, Node 12.16.1, Yarn 1.22.0, and it's working fine.
As others mentioned, it may be a CORS issue. I also get a blank page if CORS is not configured properly, but works if I add CORS configuration. Try adding this in your local.propperties and restarting the Hybris app:
corsfilter.ycommercewebservices.allowedOrigins=http://localhost:4200 https://localhost:4200
corsfilter.ycommercewebservices.allowedMethods=GET HEAD OPTIONS PATCH PUT POST DELETE
corsfilter.ycommercewebservices.allowedHeaders=origin content-type accept authorization cache-control if-none-match x-anonymous-consents
corsfilter.ycommercewebservices.exposedHeaders=x-anonymous-consents
corsfilter.assistedservicewebservices.allowedHeaders=origin content-type accept authorization x-anonymous-consents
corsfilter.assistedservicewebservices.exposedHeaders=x-anonymous-consents
NOTE: The Spartacus documentation recommends Angular 8.x, not 9.x.
0
votes
are you sure you run the app on http://localhost:4002?
The angular CLI uses the 4200 port by default. If you did mean the 4200 port, perhaps you can share any logs from the browser console? There might be some helpful messages that indicate the issue.