Uncaught ReferenceError: Promise is not defined

15,282

Solution 1

The user updated Chrome to the latest version and that apparently fixed it. I don't know how, since his version was from December 2013 and surely Promises worked back then. I don't know. It definitely isn't a problem with the code since I'm running the same exact version the user is running and I've never encountered that error.

But yeah - apparently fixed.

EDIT: Apparently Promises only work since Chrome 32, so yeah that's why the error.

Solution 2

To support IE and older versions of other browsers, you should consider loading a polyfill for the Promise object.

One implementation you can use out of the box with a <script> tag is available here.

Share:
15,282
Fabis
Author by

Fabis

Updated on June 27, 2022

Comments

  • Fabis
    Fabis almost 2 years

    A Chrome App I've made works perfectly fine for me, but another user gets an error Uncaught ReferenceError: Promise is not defined when starting it up. For some reason it doesn't understand what a Promise is. The code works perfectly fine on my end and I've never gotten that error before, but the user gets it every time. What could be the issue here?

  • Benjamin Gruenbaum
    Benjamin Gruenbaum almost 10 years
    I would not use native promises (yet) if I were you, you're much safer using a library like Bluebird.
  • Fabis
    Fabis almost 10 years
    What do you mean? Why not?
  • Benjamin Gruenbaum
    Benjamin Gruenbaum almost 10 years
    They're unstable and only provide a fragment of the functionality libraries do. They exist to interoperate with user code cleanly, not to replace libraries.