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.

Error: regeneratorRuntime is not defined

See original GitHub issue

Code

import ImapClient from 'emailjs-imap-client'

const options = {
  auth: {
    user: '<removed>',
    pass: '<removed>'
  }
}

const client = new ImapClient('imap.gmail.com', 993, options)

client.onerror = error => {
  console.log('Email client error:', error)
}

console.log('Connecting...')
client.connect().then(() => {
  console.log('Client connected!')
  console.log('Closing connection...')
  client.close().then(() => console.log('Connection closed'))
})

Expected result

Fairly straight forward. a few logs: client open, client closed. Just to test my connection to gmail.

Actual result

An error is thrown from the constructor, not from the client.onerror handler.

$ node .
E:\Documents\GitHub\Repositories\temp\node_modules\emailjs-imap-client\dist\imap.js:500
    value: /*#__PURE__*/regeneratorRuntime.mark(function _iterateIncomingBuffer() {
                        ^

ReferenceError: regeneratorRuntime is not defined
    at E:\Documents\GitHub\Repositories\temp\node_modules\emailjs-imap-client\dist\imap.js:500:25
    at Object.<anonymous> (E:\Documents\GitHub\Repositories\temp\node_modules\emailjs-imap-client\dist\imap.js:1065:2)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (E:\Documents\GitHub\Repositories\temp\node_modules\emailjs-imap-client\dist\client.js:24:13)

Indeed, in the file that the error points to:

https://github.com/emailjs/emailjs-imap-client/blob/5616706172514c9337854020af57f23aba479037/dist/imap.js#L500

The variable regeneratorRuntime isn’t defined anywhere that I can see, at least in that file.

I tried:

  1. Running in node (where import was swapped with require)
  2. Running in a browser (after building with parceljs).

So, what am I doing wrong here? I don’t see any other issues that mention this error so I must be doing something really silly…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
felixhammerlcommented, Feb 2, 2018

hi y’all, let me dive into the babel configuration later this weekend. didn’t have time to respond this week, sorry.

1reaction
felixhammerlcommented, Feb 5, 2018

The self-signed warning is b/c you didn’t bother to get a proper TLS cert 😃 Interesting though that the warning doesn’t go through the error handler. Need to look into that. Check the tcp-socket repo to generate a proper self-signed cert. For testing purposes, add that cert to your certificate store. Never skip TLS verification in your production code. If you actually run that somewhere, please set up Let’s Encrypt.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix regeneratorRuntime is not defined?
I have ran into a problem, the error is regeneratorRuntime is not defined while working with React and Parcel bundler.
Read more >
Babel 6 regeneratorRuntime is not defined - Stack Overflow
This error is caused when async/await functions are used without the proper Babel plugins. As of March ...
Read more >
ReferenceError regeneratorRuntime is not defined · Issue #9849
I'm building an SSR template, and when I use @babebl/register and then execute webpack (config), the system reported an error.
Read more >
Parcel, how to fix the `regeneratorRuntime is not defined` error
I run into this problem in a project using Babel as soon as I added an async function, but the problem is the...
Read more >
Blank Admin Page: regeneratorRuntime is not defined (babel?)
I've been trying to fix this because there is a lot of topic regarding this problem for babel but… I couldn't reach that...
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