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: regeneratorRuntime babel-present-env error?

See original GitHub issue

I think this may be a bug with babel-preset-env, just checking here first. I’m getting the error below when trying to run the tests for a new exercise I’m implementing. This error refers to this line: function* generate(A) {. Generator functions are part of the babel-preset-es2015 which should be included in babel-preset-env so I’m not sure why this is happening. Any ideas? Thanks!

 ● Test suite failed to run

    ReferenceError: regeneratorRuntime is not defined

      at Object.<anonymous> (exercises/alphametics/tmp/alphametics.js:57:15)
      at Object.<anonymous> (exercises/alphametics/tmp/temp.alphametics.spec.js:1:122)

Test Suites: 1 failed, 1 total

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
arthurchipdeancommented, Jun 1, 2017

@rchavarria You are right, after adding the babel-polyfil the error has gone away. Thanks for your help!

1reaction
rchavarriacommented, May 30, 2017

I have no idea about how to configure Babel nowadays (I did it in the past, but it has evolved a lot since then).

But just looking at the documentation, if I compare the support for arrow functions (a basic feature that makes sense to be included by default) to generators (a not so basic feature) I notice a difference:

The generators documentation shows a warning:

Runtime required You need to use either the Babel polyfill or the regenerator runtime so that regeneratorRuntime will be defined.

It seems if we want to use generators we need a plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Babel 7 - ReferenceError: regeneratorRuntime is not defined
I just encountered this problem and came across the following solution: ... npm i --save-dev @babel/preset-env npm i regenerator-runtime ...
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 >
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/polyfill
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4...
Read more >
7 - still "ReferenceError: regeneratorRuntime is not defined"
npm install --save-dev @babel/plugin-transform-runtime. But still, I get the error: ReferenceError: regeneratorRuntime is not defined.
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