gatsby: WebpackError: TypeError: merge is not a function (from plugin: gatsby-plugin-react-helmet)
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
When updating to the latest Gatsby releases (3.14.0 or next) builds are failing with the following error:
Building static HTML failed for path "/tags/cryptocurrency/" π this is random
See our docs page for more info on this error: https://gatsby.dev/debug-html
100 | }
101 |
> 102 | return merge(a, b, { arrayMerge: combineMerge })
| ^
103 | }
104 |
105 | export default async function staticPage({
WebpackError: TypeError: merge is not a function (from plugin: gatsby-plugin-react-helmet)
Reproduction Link
.
Steps to Reproduce
babel-preset-gatsby 1.13.0 β 1.14.0
gatsby 3.13.1 β 3.14.0
gatsby-plugin-feed 3.13.0 β 3.14.0
gatsby-plugin-gatsby-cloud 3.1.0 β 3.2.0
gatsby-plugin-google-tagmanager 3.13.0 β 3.14.0
gatsby-plugin-image 1.13.0 β 1.14.0
gatsby-plugin-manifest 3.13.0 β 3.14.0
gatsby-plugin-react-helmet 4.13.0 β 4.14.0
gatsby-plugin-sharp 3.13.0 β 3.14.0
gatsby-plugin-sitemap 4.9.0 β 4.10.0
gatsby-source-filesystem 3.13.0 β 3.14.0
gatsby-source-wordpress 5.13.0 β 5.14.0
gatsby-transformer-sharp 3.13.0 β 3.14.0
Expected Result
Should build
Actual Result
Doesnβt build
Environment
System:
OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm
npmPackages:
gatsby: 3.13.1 => 3.13.1
gatsby-plugin-eslint: 4.0.0 => 4.0.0
gatsby-plugin-feed: 3.13.0 => 3.13.0
gatsby-plugin-gatsby-cloud: 3.1.0 => 3.1.0
gatsby-plugin-google-tagmanager: 3.13.0 => 3.13.0
gatsby-plugin-image: 1.13.0 => 1.13.0
gatsby-plugin-manifest: 3.13.0 => 3.13.0
gatsby-plugin-netlify: 3.14.0 => 3.14.0
gatsby-plugin-react-helmet: 4.13.0 => 4.13.0
gatsby-plugin-react-helmet-canonical-urls: 1.4.0 => 1.4.0
gatsby-plugin-react-i18next: 1.1.1 => 1.1.1
gatsby-plugin-sharp: 3.13.0 => 3.13.0
gatsby-plugin-sitemap: 4.9.0 => 4.9.0
gatsby-plugin-theme-ui: 0.11.2 => 0.11.2
gatsby-source-filesystem: 3.13.0 => 3.13.0
gatsby-source-google-spreadsheets: 3.0.8 => 3.0.8
gatsby-source-wordpress: 5.13.0 => 5.13.0
gatsby-source-youtube-v3: 3.0.2 => 3.0.2
gatsby-transformer-sharp: 3.13.0 => 3.13.0
Config Flags
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 16
- Comments: 18 (5 by maintainers)
Commits related to this issue
- Include yarn.lock file. Using yarn seems to fix an issue during the build process where the 'merge' function was not being recognized due to a dependency issue somewhere and Gatsby including deepmerg... — committed to lukemcdonald/gettreadtalks.com by lukemcdonald 3 years ago
- Pin gatsby to 3.13.1 https://github.com/gatsbyjs/gatsby/issues/33274 — committed to tsengjonathan/outtaink.com by tsengjonathan 3 years ago
- Move Discover filters to the top (#300) * Compartmentalize discover pt 1 * Compartmentalize discover pt 3 * Improve discover hit buttons * Extract filters bar component * Extract filters ... — committed to responsible-ai-collaborative/aiid by cesarvarela 3 years ago
- Tidy up discover results (#319) * Compartmentalize discover pt 1 * Compartmentalize discover pt 3 * Improve discover hit buttons * Extract filters bar component * Extract filters componen... — committed to responsible-ai-collaborative/aiid by cesarvarela 3 years ago
- fix: build issue https://github.com/gatsbyjs/gatsby/issues/33274 — committed to arnaud-deprez/arnaud-deprez.github.io by arnaud-deprez 3 years ago
- fix ci https://github.com/gatsbyjs/gatsby/issues/33274 — committed to chg1f/blog by chg1f 2 years ago
- add deepmerge dependency - https://github.com/gatsbyjs/gatsby/issues/33274#issuecomment-938477858 — committed to PizzaMyHeart/clair-storefront by PizzaMyHeart 2 years ago
- fix build https://github.com/gatsbyjs/gatsby/issues/33274 — committed to blopa/Resume-Builder by blopa a year ago
Another temporary solution is adding explicitely
deepmergedependency to your project.add deepmerge dependency and it worked
Thanks @pdeszynski
I just upgraded to Gatsby 4, this is still broken. Not sure why itβs closed? @LekoArts
Unfortunately switching from npm to yarn is not an option for me.
I submitted a PR https://github.com/formium/formik/pull/3353 to bump formikβs version of deepmerge.
I reverted to gatsby 3.13.1 for the meantime.
Debugging Screenshots
Iβve removed the package-lock.json file, removed the
flagsinsidegatsby-config.js, did ayarnand rungatsby buildand it works all fine:When I use your exact setup with the lock file + flags I also get the error:
When I then check the installed version of
deepmergeI see:In
node_modulesyou can see that1.5.2is installed, not4.2.2:Your usage of
@wordpress/block-library@6.0.0and its usage of this olddeepmergepackage is at fault. Iβve tried deletingpackage-lock.jsonand doing a fresh install but it still fails. As often,yarnseems to be smarter here as it dedupes to the latest version:In https://github.com/gatsbyjs/gatsby/pull/33051 weβve added
deepmergeto our dependencies and you now might see this if a third-party library is using an outdated version. You can open an issue on the repository of that third-party library, send in a PR or useyarn resolutionsto force the correct version.Sadly thereβs not much more that we can do, thatβs just npm and its ecosystem π€·
using npm install deepmerge then building again worked for me π
This issue is in Gatsby new version, i switch back to 3.11.1 & it is resolved.
Hi,
I have the same issue as well.
Reproduction Link
https://github.com/ekon97/Gatsby-WebpackError-Merge
Steps to Reproduce