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
4 Answers
This sounds like either there is no Sampledata present in Hybris or there is a CORS Issue, have you installed a Samplestore in Hybris and configured CORS?
Here are the links to the Spartacus documentation:

- 190
- 6
-
I have installed the sample store and data is present also.I am able to load the store https://localhost:9002/yacceleratorstorefront?site=electronics&clear=true – Amal Mar 02 '20 at 06:38
-
I have the below property in local.properties file corsfilter.ycommercewebservices.allowedHeaders=origin content-type accept authorization cache-control if-none-match x-anonymous-consents – Amal Mar 02 '20 at 06:45
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.

- 3,279
- 2
- 32
- 58
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.

- 1,250
- 1
- 8
- 10
-
-
Anything on the console? There should be an error or warning. – tobi-or-not-tobi Feb 27 '20 at 13:58
-
No, I am not getting anything on the console. The OCC calls to Hybris CMS is not happening from the storefront. – Amal Feb 28 '20 at 05:28
-
Just to make sure, I'm referring to the browser console, not the hybris console. If you do not get anything, can you double check the Spartacus setup? If you don't see anything on the page or console, you probably missed a step. For example, did you add the `
` element in the `app.component.html`? – tobi-or-not-tobi Feb 28 '20 at 07:20 -
Nothing in browser console. I have double checked the setup- everything is in place.Even in the index.html page I could see the tag . But still contents from hybris CMS are not getting pulled up. – Amal Mar 02 '20 at 06:35
-
strange. Can you create a reproduction? or share the `app.module.ts` and `app.component.html`? – tobi-or-not-tobi Mar 02 '20 at 07:59
The issue is fixed.It was because of the latest versions of node and angular cli we used.

- 61
- 1
- 5
-
Can you share the fix? What versions of Node and Angular CLI did you downgrade to? – geffchang Mar 03 '20 at 04:09
-
I have tested with the (latest) Angular CLI 8.3.25, Node 12.16.1, Yarn 1.22.0, and it's working fine. So, the "latest version" is not the problem. – geffchang Mar 05 '20 at 05:01
-
-
Ah, so you were talking about latest 9.x. I meant latest 8.x. The Requirements section of the Spartacus documentation does not recommend using v9.x -> `Angular CLI: v8.0.0 or later, < v9.0.0` – geffchang Mar 05 '20 at 09:11
-
Now that this issue is fixed, you can update your own answer with the changes you made, and mark it as Accepted. ( Or, you can choose to accept another answer ) – geffchang Mar 05 '20 at 09:41