question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

serverside ReferenceError: Element is not defined

See original GitHub issue

I am using gatsby and getting this error when building:

alexa@PCA C:\Users\alexa\vermehrung
$ yarn build
yarn run v1.22.4
$ gatsby clean && gatsby build
info Deleting .cache, public
info Successfully deleted directories
success open and validate gatsby-configs - 0.039s
success load plugins - 1.650s
success onPreInit - 0.014s
success delete html and css files from previous builds - 0.009s
success initialize cache - 0.008s
success copy gatsby files - 0.070s
success onPreBootstrap - 0.006s
success createSchemaCustomization - 0.037s
success source and transform nodes - 0.172s
success building schema - 0.257s
success createPages - 0.044s
success createPagesStatefully - 0.066s
success onPreExtractQueries - 0.001s
success update schema - 0.021s
success extract queries from components - 1.525s
success write out requires - 0.007s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.079s
success onPostBootstrap - 0.085s
⠀
info bootstrap finished - 6.826 s
⠀
success Building production JavaScript and CSS bundles - 115.974s
success Rewriting compilation hashes - 0.005s
success run queries - 117.231s - 35/35 0.30/s
failed Building static HTML for pages - 51.774s

 ERROR #95313

Building static HTML failed

See our docs page for more info on this error: https://gatsby.dev/debug-html



  ReferenceError: Element is not defined

  - render-page.js:183275 Module../node_modules/react-resize-detector/lib/esm/components/ResizeDetector.js
    C:/Users/alexa/vermehrung/public/render-page.js:183275:76

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:183428 Module../node_modules/react-resize-detector/lib/esm/index.js
    C:/Users/alexa/vermehrung/public/render-page.js:183428:84

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:249242 Module../src/components/Header/Doku.js
    C:/Users/alexa/vermehrung/public/render-page.js:249242:79

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:249402 Module../src/components/Header/index.js
    C:/Users/alexa/vermehrung/public/render-page.js:249402:63

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:249423 Module../src/components/Layout.js
    C:/Users/alexa/vermehrung/public/render-page.js:249423:65

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:292429 Module../src/pages/404.js
    C:/Users/alexa/vermehrung/public/render-page.js:292429:76

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:694 Object../.cache/sync-requires.js
    C:/Users/alexa/vermehrung/public/render-page.js:694:323

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30

  - render-page.js:644 Module../.cache/static-entry.js
    C:/Users/alexa/vermehrung/public/render-page.js:644:1763

  - render-page.js:30 __webpack_require__
    C:/Users/alexa/vermehrung/public/render-page.js:30:30


not finished Generating image thumbnails - 170.852s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This did not happen before updating from v4 to v5.

Seems related to https://github.com/maslianok/react-resize-detector/issues/70

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
DovahBrowniescommented, Jun 17, 2020

@maslianok Awesome work. Hope my comment was helpful haha.

1reaction
barbalexcommented, Jun 17, 2020

v5.0.6 works for me.

If this were a paid product I would now thank you for the great service.

As it is open source and I have no right to expect anything from you, I hope you will enjoy a fine beer this evening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular SSR: ReferenceError: Element is not defined #1315
Describe the bug I'm trying to enable SSR on my Angular project with SAP Spartacus, but when i instance with 'new AdyenCheckout(config)' and...
Read more >
Angular SSR - ReferenceError: Element is not defined
I have an angular 7 project that I'm developping. I use server-side rendering to allow facebooks crawler ...
Read more >
ReferenceError: "x" is not defined - JavaScript - MDN Web Docs
ReferenceError : "x" is not defined. The JavaScript exception "variable is not defined" occurs when there is a non-existent variable referenced somewhere.
Read more >
How to fix ReferenceError: Document is not defined ... - Sabe.io
In this post, we looked at the most common reasons that causes the document reference error in JavaScript. The main culprits are using...
Read more >
How To Fix ReferenceError document is not defined ... - Isotropic
If you are trying to use the document object and receiving a ReferenceError: document is not defined error then there is a good...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found