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 is not defined

See original GitHub issue

Hi, I’m using create-react-app for my project and I followed the instructions listed in the documentation located here:

https://kea.js.org/guide/installation

The instructions I followed was Adding to apps made with create-redux-app.

After running through all of the following I npm start my application and I’m receiving the following errors.

ReferenceError: regeneratorRuntime is not defined

I figured this might just be an issue with the node_modules so I removed the entire node_modules folder and went ahead and re-installed all the packages using npm install since everything I installed the previous time had the --save flag, so essentially that would give me a clean copy of all my dependencies. Still receiving the same error.

Am I missing something??

This is what my package.json looks like:

{
  "name": "app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "bulma": "^0.5.1",
    "custom-react-scripts": "^0.1.4",
    "flow-bin": "^0.52.0",
    "font-awesome": "^4.7.0",
    "history": "^4.6.3",
    "husky": "^0.14.3",
    "kea": "^0.20.8",
    "lint-staged": "^4.0.2",
    "node-sass-chokidar": "0.0.3",
    "npm-run-all": "^4.0.2",
    "prettier": "^1.5.3",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-redux": "^5.0.6",
    "react-router-dom": "^4.1.2",
    "react-router-redux": "^4.0.8",
    "redux": "^3.7.2",
    "redux-saga": "^0.15.6",
    "reselect": "^3.0.1"
  },
  "lint-staged": {
    "src/**/*.{js,jsx,json,css}": [
      "prettier --single-quote --write",
      "git add"
    ]
  },
  "scripts": {
    "start-js": "react-scripts start",
    "start": "npm-run-all -p watch-css start-js",
    "build": "npm run build-css && react-scripts build",
    "flow": "flow",
    "precommit": "lint-staged",
    "build-css": "node-sass-chokidar src/ -o src/",
    "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook"
  },
  "devDependencies": {
    "@storybook/react": "^3.2.3"
  }
}

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mariusandracommented, Aug 13, 2017

Hey, something changed with the latest create-react-app, released August 9th. I’m not sure what broke regenerator and babel-polyfill, but searching for the error “ReferenceError: regeneratorRuntime is not defined” gives many results of projects with similar problems.

However, it appears that the real fix was to move kea to use babel-runtime. So starting with 0.22, kea should work again with CRA.

1reaction
imhugofonsecacommented, Aug 12, 2017

I solved this issue by ejecting and inserting the runtime requirement in the polyfills.js If you are not scared to eject follow this steps:

  1. Eject
  2. Install runtime transform and decoratores yarn add babel-plugin-transform-runtime babel-plugin-transform-decorators-legacy
  3. Make sure your package.json has this plugins
    "plugins": [
      "transform-decorators-legacy",
      [
        "transform-runtime",
        {
          "polyfill": false,
          "regenerator": true
        }
      ]
    ]
  1. Add require('regenerator-runtime/runtime');to the config/polyfills.jsfile, so its executed in babel entry point.
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 only works because it no longer transforms async/await and thus no longer needs the regeneratorRuntime and because it's not transformed it ...
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 >
regeneratorRuntime is not defined when running jest test
I got the ReferenceError: regeneratorRuntime is not defined error. Please attach your logs beforehand. ○ Test suite failed to run ReferenceError: ...
Read more >
Parcel, how to fix the `regeneratorRuntime is not defined` error
Parcel, how to fix the `regeneratorRuntime is not defined` error ... avoid this error you need to also load the regenerator-runtime runtime.
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