-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
"regeneratorRuntime is not defined" throwing this error with plugins #1818
Comments
I just tried reinstalling the latest code with https://github.com/gatsbyjs/gatsby/tree/master/examples/using-contentful and didn't see this error. Can you reproduce your error with this site? We've seen a few reports of this error lately but don't know why it's happening. Perhaps it's something about your setup. If you can reproduce the problem there, please list your version of node/npm/operating system. |
If you can't reproduce the problem, try removing |
also make sure you have the latest gatsby-cli installed.
I had the same issue, but I re-installed using the latest cli and the issue went away. |
@KyleAMathews @bskimball I couldn't figure out the issue but by simply re installing everything seems working. I don't know why is the problem was firing. |
I got the same problem. I cloned the gatsby-blog-starter repo and I was able to compile without any issue. Then I removed the I will re-produce and provide screenshot of the errors if you need. |
Try upgrading gatsby-cli to the latest version. |
I upgraded |
(Just adding another data point.) Even after updating |
This error occurs for me after updating either:
All other plugins/transforms upgrade successfully. |
@bvaughn do you have an idea which file is throwin the error? All new code should grab the runtime from |
As in perhaps some plugin wasn't published again after we changed that |
The error would be different tho if the problem was babel-runtime is missing. e.g. "Cannot find module babel-runtime/regenerator", this sounds like it's looking for a global regenerator |
For ReferenceError: regeneratorRuntime is not defined
at /Users/bvaughn/Documents/git/react/www/node_modules/gatsby-plugin-sharp/index.js:12:47
at Object.<anonymous> (/Users/bvaughn/Documents/git/react/www/node_modules/gatsby-plugin-sharp/index.js:97:2)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/bvaughn/Documents/git/react/www/node_modules/gatsby-transformer-sharp/extend-node-type.js:28:17)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17) Which points to: var _ref4 = (0, _asyncToGenerator3.default)(regeneratorRuntime.mark(function _callee2(_ref3) { For ReferenceError: regeneratorRuntime is not defined
at /Users/bvaughn/Documents/git/react/www/node_modules/gatsby-plugin-sharp/index.js:12:47
at Object.<anonymous> (/Users/bvaughn/Documents/git/react/www/node_modules/gatsby-plugin-sharp/index.js:97:2)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/bvaughn/Documents/git/react/www/node_modules/gatsby-transformer-sharp/extend-node-type.js:28:17)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17) Which points to: var _ref4 = (0, _asyncToGenerator3.default)(regeneratorRuntime.mark(function _callee2(_ref3) { So both are referencing an undefined |
@KyleAMathews it may be that those plugins were published again since nothing in them technically changed (according to lerna)? |
In version <= var _regenerator = require("babel-runtime/regenerator");
var _regenerator2 = _interopRequireDefault(_regenerator); But in version 1.4.2 it's gone. Ditto for Seems like we need to add |
yeah, 1.4.2 I believe contained a change where we just relied on the global polyfill, we then reverted that to go back to babel-runtime for the packages. We do need to add the runtime as a dep , tracking that here: #1825 |
Excellent. Thanks for the update |
I added babel-runtime to all packages so hopefully this error won't show up anymore. |
So I think we are at the end of a path so we can close this issue? @KyleAMathews |
Yeah. We can reopen if it's still causing trouble. |
@KyleAMathews when importing separate modules that require regeneratorRuntime getting the error |
I'f I'm trying to use typescript async, I'm getting this issue. |
Same issue here. Getting regeneratorRuntime is not defined |
try adding the following to gatsby-node.js
|
I did this and it helped somewhat, but what really solved it was adding:
Don't forget to also install:
Works great now with async Apollo queries on https://spacechop.com btw, tell me if you want a 3 month free test coupon on SpaceChop! :D |
@timbrandin Would this have fixed your problem? #1847 (comment) |
Noop, did not have to do with Babel-polyfon at all |
@timbrandin awesome that helped alot but to run |
For anyone coming across this in more recent history than 2018, it appears that the gatsby APIs used to accomplish this have changed. I was able to get this working with the following in exports.onCreateBabelConfig = ({ actions }) => {
if (process.env.NODE_ENV !== 'development') {
actions.setBabelPlugin({
name: '@babel/plugin-transform-regenerator',
options: {},
});
actions.setBabelPlugin({
name: '@babel/plugin-transform-runtime',
options: {},
});
}
}; |
When I'm trying to include data source as contentful, JSON it's throwing this error
regeneratorRuntime is not defined
I don't know why is that ? When I'm simply just including this to plugins as array and recompile the whole project it's not compiling and throwing this error. I don't understand why is that happening.The text was updated successfully, but these errors were encountered: