Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing regenerator-runtime #1905

Closed
jamesjnadeau opened this issue Aug 24, 2017 · 18 comments
Closed

Missing regenerator-runtime #1905

jamesjnadeau opened this issue Aug 24, 2017 · 18 comments

Comments

@jamesjnadeau
Copy link

Encountered this error when trying things out for the first time, I'm using the latest version, aka i installed with npm install -g gatsby-cli@latest

I was getting the following error:
chronos@localhost ~/Downloads/Code $ gatsby new tutorial-part-one https://github.com/gatsbyjs/gatsby-starter-hello-world
module.js:327
throw err;
^

Error: Cannot find module 'regenerator-runtime/runtime'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/share/nvm/versions/node/v4.8.4/lib/node_modules/gatsby-cli/index.js:92:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)

I'm using a chromebook with node installed on it through chromebrew, so maybe I'm the problem. I was able to fix it by running a npm install regenerator-runtime in the gatsby-cli install location, that seems to have fixed my issue.

@KyleAMathews
Copy link
Contributor

Yeah, we're not actively testing on Node 4 anymore… which is perhaps the problem. Though gatsby-cli already has babel-runtime which should provide the regenerator-runtime I thought.

@jquense
Copy link
Contributor

jquense commented Aug 24, 2017

@KyleAMathews the problem is some packages are expecting it to be a global object. the runtime doesn't do that. gatsby-cli shouldn't be expecting it, and i'm not at all sure why its compiling that way. There must be something off with the preset-env configuration

@KyleAMathews
Copy link
Contributor

Hmmm yeah. This page says you can use either babel-polyfill or the regenerator-runtime but babel-cli is compiled to be requiring the regenerator-runtime https://unpkg.com/gatsby-cli@1.1.3

@KyleAMathews
Copy link
Contributor

Perhaps we're missing the transformer-regenerator plugin?

@jquense
Copy link
Contributor

jquense commented Aug 24, 2017

I think we need tell babel-preset-env to not transpile the "useBuiltins" bit for the runtime...i'm not sure how to do that.

@jamesjnadeau
Copy link
Author

before you guys go deep into this, I was using a new setup, and this was the first thing I tried to run. Other existing projects are not working as well. I'm going to close this for now until I can more reliably reproduce the problem from a known working setup

@jquense
Copy link
Contributor

jquense commented Aug 24, 2017

@KyleAMathews
Copy link
Contributor

@jamesjnadeau nah you're good :-) other people have this problem too so we need to fix it.

@KyleAMathews KyleAMathews reopened this Aug 24, 2017
@whmountains
Copy link

This is probably related to #1847 .

@KyleAMathews
Copy link
Contributor

@whmountains yeah, we didn't fix it apparently

@KyleAMathews
Copy link
Contributor

@jquense hmmm feeling tired but if I read that right the regenerator isn't automatically being added right now (bug perhaps) so we should just manually import it?

@jquense
Copy link
Contributor

jquense commented Aug 24, 2017

The problem here is that we are expecting calls "regeneratorRuntime" to be transpiled to require('babel-runtime/regenerator'), And that's what is happening in all the packages (see: https://unpkg.com/gatsby@1.9.7/dist/bootstrap). However the initial require('babel-polyfill') in the entry file is being transpiled down to each individual require to the polyfill (becasue we have useBuiltins set) THAT is seeing we need the regenerator transform and adding a require to require("regenerator-runtime/runtime"); which is not being found, becasue we are expecting it in babel-runtime

@jamesjnadeau
Copy link
Author

So, I did get my setup working, and I still had to go in to the install and run npm install regenerator-runtime for node 4.8.4, good luck!

@topaztee
Copy link

topaztee commented Nov 7, 2017

running both node 8.9 and 7. Having the same issue.

@heldrida
Copy link

just ssh to my ubuntu vps, latest nodejs v9.1.0 same issue

@vjpr
Copy link

vjpr commented Mar 22, 2018

Why not jus add regenerator-runtime to package.json for gatsby-cli?

@KyleAMathews
Copy link
Contributor

v2 beta is out with an upgrade to babel v7. Please try it out and report if there's any more problems!

@MaralS
Copy link

MaralS commented Mar 6, 2019

I still have the same message when I try to build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants