JuanDiegoBS
JuanDiegoBS

Reputation: 41

SSR in Spartacus Storefront Message

I added SSR Support, but when I run the command: npm run build:ssr && npm run serve:ssr, appears this message, anyone knows why?

SSR Message

Upvotes: 1

Views: 161

Answers (1)

Vicente Grajeda
Vicente Grajeda

Reputation: 3

In your local directories, open /server/main.js and navigate to line 1:4106087 (line 1 column 4106087). You should be able to exactly pinpoint where the error is being thrown.

Put a validation on every place you use Element, such as:

import {isPlatformBrowser} from '@angular/common';

...

constructor(@Inject(PLATFORM_ID) private platformId: number) {}

if (isPlatformBrowser(this.platformId)) {
    // Your code here where you access the DOM
}
...

Upvotes: 0

Related Questions