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.

ReferenceError: window is not defined

See original GitHub issue

I am using node and trying to implement the most basic example:

var places = require('places.js');
var placesAutocomplete = places({
    container: document.querySelector('#address-input')
});

When I run the node server I am getting the error “ReferenceError: window is not defined”. To my understanding there is no global window variable in node. Is there a workaround for this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

0reactions
Haroenvcommented, Mar 22, 2018

Can you also make a reproduction @willcode4food? In your case you should probably put the whole autocomplete call in a condition if window is defined

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve "window is not defined" errors in React and Next.js
How to solve "window is not defined" errors in React and Next.js · 1. First solution: typeof · 2. Second solution: the useEffect...
Read more >
How to solve Next.js window is not defined
ReferenceError: window is not defined is a pretty common error you may run into when using Next.js for the first time but don't...
Read more >
referenceerror: window is not defined, how to solve
Here's how to fix the “referenceerror: window is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >
How To Solve ReferenceError window is not defined in ...
Fixing a window is not defined error can be quite simple. In most cases, all you will need to do is wrap your...
Read more >
[Solved] ReferenceError : window is not defined - ItsJavaScript
The ReferenceError : window is not defined error mainly occurs if you are using the window object in Node.js, React.js, Next.js.
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