Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1 fix 'window is not defined' error in serverside rendering #1

Closed
roseline124 opened this issue Sep 7, 2019 · 1 comment
Closed

Comments

@roseline124
Copy link
Owner

roseline124 commented Sep 7, 2019

Problem description

  • cannot access 'window' in server side when building gatsby

Causes of this problem

Kyle said:
during development, react components are only run in the browser where window is defined. When building, Gatsby renders these components on the server where window is not defined


Solutions

  • access window in componentDidMount
  • check that window exists before accessing it
@roseline124
Copy link
Owner Author

another error(following above error) : Building static HTML failed for path "/hello-world/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant