Document is not defined

Pretty much what it says on the tin. I just installed Uppy and am trying to integrate it into my website. However, I’m getting the ReferenceError “document is not defined” on line 13 of findDOMElement.js:

return document.querySelector(element);

I’ve reinstalled Uppy twice to no avail. I just don’t see where or how the variable “document” should be declared. I’d appreciate any help you have to offer!


document is a global variable available in a browser.

Two ideas that come to mind: 1. Make sure your code is running in the browser, not in Node; 2. try placing the <script> tag that you use to include Uppy just before the closing </body> element in your HTML.

If that doesn’t help, please share the code that you use to run Uppy. Also please check out the live integration example here:

… This may seem like a silly question, but how do I run my code in the browser?

You can generate a browser capable bundle using browserify and include it in a script tag.
I’m curious how you are using it right now—are you running your scripts in Node?