I'm getting this warning
â „ source and transform nodes
WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option.
You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands:
npm install --save core-js@2 npm install --save core-js@3
yarn add core-js@2 yarn add core-js@3
that drives to what seems a non execution of gatsby-node.js that then kills my site.
But I only have it when I update the dependencies.
Find below the package.json that works. If I then upgrade gatsby to version 2.3.5 it gives the warning (and later on error). It seems the same as #12744 (but that one is fixed) ?
package.json that works
child child theme
"gatsby": "2.1.4",
"react": "16.8.4",
"react-dom": "16.8.4",
"path": "0.12.7",
"gatsby-plugin-page-creator": "2.0.10",
"(child theme)"
child theme
"styled-components": "4.1.3",
"babel-plugin-styled-components": "1.10.0",
"gatsby-plugin-styled-components": "3.0.6",
"path": "0.12.7",
"esm": "3.2.14",
"prop-types": "15.7.2",
"gatsby-plugin-page-creator": "2.0.10",
"gatsby-source-filesystem": "2.0.23",
"gatsby-plugin-gtag": "1.0.10",
"gatsby-plugin-manifest": "2.0.22",
"gatsby-plugin-compile-es6-packages": "1.0.6",
"react-cookie-consent": "2.2.2",
"styled-icons": "7.4.2"
"(core-theme)"
core theme
"styled-components": "4.1.3",
"babel-plugin-styled-components": "1.10.0",
"gatsby-plugin-styled-components": "3.0.6",
"path": "0.12.7",
"esm": "3.2.14",
"prop-types": "15.7.2",
"gatsby-plugin-page-creator": "2.0.10",
"gatsby-source-filesystem": "2.0.23",
"gatsby-plugin-compile-es6-packages": "1.0.6",
"styled-icons": "7.4.2",
"gatsby-image": "2.0.31",
"gatsby-mdx": "0.4.2",
"@mdx-js/mdx": "0.20.3",
"@mdx-js/tag": "0.20.3",
"gatsby-plugin-offline": "2.0.24",
"gatsby-plugin-react-helmet": "3.0.8",
"gatsby-plugin-sharp": "2.0.25",
"gatsby-transformer-sharp": "2.1.15",
"react-helmet": "5.2.0",
"react-share": "2.4.0"
I’m running into this issue as well.
I've seen now that with gatsby 2.1.4, with esm 3.2.20 it works, but with esm 3.2.21 it triggers the error. I have to say that my gatsby-node.js points to a gatsby-node.esm.js through this package.
UPDATE1: DELETED _And it seems that with gatsby 2.3.5 and esm 3.2.20 it also works_
UPDATE2: But it is not only the esm package, I've upgraded all the packages but keeping esm 3.2.20 and the error is triggered
UPDATE3: No, update1 was wrong, I need to downgrade gatsby
UPDATE4: So, after a bunch of tests, it is strange:
[email protected] and [email protected] and running develop it works[email protected] and [email protected] and running develop it works (I have the warning, but gatsby-node seems to be executed as expected)[email protected] and [email protected] it fails when .cache is deleted, so if before run develop I delete the folder (and the public as well), it fails. BUT if I don't delete the folder, then it doesn't fail (this has driven me crazy btw), or at least there's no error messageIf I go back to [email protected], where it never fails (no matter if I delete or not the cache, but if I don't delete it I don't see the warning, anyway it seems to always process gatsby-node), then going to [email protected] makes it fail. It is the same error as with gatsby but this time preceeded by a bunch of related errors such as ReferenceError: setFieldsOnGraphQLNodeType is not defined. I say related because the error I do see relates to the part setFieldsOnGraphQLNodeType not being executed.
Hope it makes sense
Ive seen this error and I don't have esm.
It probably isn't coming directly from gatsby (or one of gatsby packages/plugins maintained here) - this really seem like some Node.js code that is transpiled with [email protected] (version of babel this warning was added) without updating @babel/preset-env configuration.
We use [email protected] right now for building packages (note that this is happening during gatsby bootstrap phase - so not when webpack is doing work), so this must be in Node code.
Can you show gatsby info to see what packages you are using? Or ideally share reproduction?
I can see that [email protected] (gatsby fails) works with
"@babel/core": "^7.4.0"
"@babel/preset-env": "^7.4.2"
and [email protected] (gatsby works) works with
package.json
"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.4"
My gatsby info
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 2.7.16 - C:\Python27\python.EXE
Browsers:
Edge: 44.17763.1.0
npmPackages:
gatsby: ^2.1.4 => 2.1.4
gatsby-plugin-compile-es6-packages: ^1.1.0 => 1.1.0
gatsby-plugin-offline: ^2.0.25 => 2.0.25
gatsby-plugin-page-creator: ^2.0.12 => 2.0.12
gatsby-plugin-react-helmet: ^3.0.11 => 3.0.11
gatsby-plugin-sharp: ^2.0.32 => 2.0.32
gatsby-plugin-styled-components: ^3.0.7 => 3.0.7
gatsby-source-filesystem: ^2.0.28 => 2.0.28
gatsby-theme-inici: ^0.2.26 => 0.2.26
gatsby-transformer-sharp: ^2.1.17 => 2.1.17
@pieh I see that I receive a warning for each .mdx file that I have in the folder (to be parsed, etc). So it has to be related to gatsby-mdx (?)
I checked and it seems like gatsby-mdx did fix this in [email protected] ( https://github.com/ChristopherBiscardi/gatsby-mdx/commit/78b5893f0ff42a9d8a0e01bb68411ae892ccbb0f#diff-8de08d558f657ab05545b5023ac10283 ) - can you try using that (or later)
A newbie question, but how can I update if the npm package is still in the 0.4.4 version?
UPDATE: I've done it by npm i gatsby-mdx@next to the 0.5.6, but it broke the site
error Plugin gatsby-mdx returned an error
TypeError: Cannot read property 'forEach' of undefined
- index.js:66 AsyncFunction.createMdxAstCompiler
[sample_child_child_theme]/[@mdx-js]/mdx/index.js:66:13
- gen-mdx.js:92 genMDX
Module not found: Error: Can't resolve '@mdx-js/react' in '...\sample_child_child_theme\node_modules\gatsby-mdx'
this relates to graphql queries (if you keep reading the log, the foreach is about the queries), but as I see in your link, maybe the "@babel/core": "^7.4.0", is causing the problems, since gatsby is with @babel/core": "^7.0.0",?
UPDATE2: I've updated all the packages (gatsby and esm being the critical ones), to see if this magically disappear, but nops. I have errors on gatsby-node that uses the esm module
Error: ...\sample_child_child_theme\site\node_modules\gatsby\dist\utils\api-runner-node.js:94
ReferenceError: onPreBootstrap is not defined
...
ReferenceError: setFieldsOnGraphQLNodeType is not defined
...
ReferenceError: createPages is not defined
...
ReferenceError: onCreateWebpackConfig is not defined
In this sense, I guess that I'll be able to update everything once gatsby uses the >=7.4.0 version. So that until then gatsby and esm relation is broken. So that I cannot test the improvements of gatsby-mdx due to this (my guess)
You can change the value inside package.json, another option is to run npm update
you might also need to update peerDependencies of gatsby-mdx package - it seems like gatsby-mdx changed those between 0.4.4 ( https://github.com/ChristopherBiscardi/gatsby-mdx/blob/v0.4.4/packages/gatsby-mdx/package.json#L10-L13 ) and 0.5.5 (https://github.com/ChristopherBiscardi/gatsby-mdx/blob/v0.5.5/packages/gatsby-mdx/package.json#L10-L13) so you need to install/update them as well
I ended up fixing this with the help of install-peerdeps:
$ yarn add gatsby-mdx@next
$ install-peerdeps gatsby-mdx@next
Note that @mdx-js/tag has been replaced by @mdx-js/react, so you’ll have to change any imports for that too.
Yes, fixed (apparently) by updating to
"@mdx-js/mdx": "^1.0.0-rc.0",
"@mdx-js/react": "^1.0.0-rc.0",
"gatsby-mdx": "^0.5.7",
with that, gatsby develop doesn't give me the previous warnings.
I'm however still with
"gatsby": "<=2.1.4",
"esm": "<=3.2.14",
as otherwise the site doesn't run (in my hands). My assumption is that when gatsby jumps to "@babel/core": "^7.4.0" I'll be able to update
@kuworking mind creating a small reproduction than I can get this bug fixed
It is not small, but it might be useful(?), the repo used here, which is this one has this problem.
It also has another problem (which is the bug of the referenced issue) but that can be solved by eliminating the line that causes the bug (identified in the thread).
But now that I remember the bug is not breaking the compilation, just hiding images. So it means that with that repo, if you upgrade packages, it doesn't compile.
*I will try to make a smaller repo if this one is too intrincated ASAP
@kuworking mind creating a small reproduction than I can get this bug fixed
Hi @wardpeet, at the end I was having a bunch of errors and I've decided to ditch esm, thinking that this was causing the error.
__It is not.__
I have made a minimal repo
https://github.com/kuworking/test_cannot_update_workspace
where all packages are up to their last version except gatsby. At version 2.1.4 (as it is in the repo) it works. If you update to the latest (2.3.30) it is not working (gatsby develop).
What is the reason? I was so convinced it was related to esm ...
This is weird:
If you
. git clone the_repo
. yarn
. yarn workspace site develop
it doesn't work
Then, if you go to
https://github.com/kuworking/test_cannot_update_workspace/blob/master/packages/gatsby-theme-inici/gatsby-node.js#L58
And there add a silly console.log
exports.setFieldsOnGraphQLNodeType = function(_ref) {
console.log('heeeeeey') //<<<< add this one
var type = _ref.type
if (type.name === 'Mdx')
Then it __works__ (I would add a smiley of shock here)
Then you can delete it and it __still works__.
You can delete node_modules and .cache and then yarn and then it does __not__ work again.
It is weird, isn't it?
At the end, I've solved it by moving from setFieldsOnGraphQLNodeType to onCreateNode. Reading the docs I'd say I wasn't using properly the former, and it ended up in not working consistently (like if depending on when it was executed, the changed nodes would be available or not).
Somehow with the old Gatsby this wasn't a problem.
With onCreateNode I am able to use the same functionality, following this and with everything updated (no esm though, I've moved to CommonJS for gatsby-node).
So should I close the ticket?
Yes please, thanks for letting us know you resolved it. And sorry for the inconveniences it may have caused
FYI, for anyone who runs into this issue, gatsby-mdx has been migrated to gatsby-plugin-mdx. Please review the documentation here on the proper installation of gatsby + mdx.
At the present time you need the following:
npm install --save gatsby-plugin-mdx @mdx-js/mdx @mdx-js/react
Most helpful comment
I ended up fixing this with the help of
install-peerdeps:Note that
@mdx-js/taghas been replaced by@mdx-js/react, so you’ll have to change any imports for that too.