GatsbyCloud build fails with "lerna ENOENT" in monorepo setup

7 replies
Last updated: May 12, 2023
This is a GatsbyCloud + Lerna question, but before creating a GitHub issue I thought I’d ask.
Builds on GC fail since a week ago. Believe it’s not honoring the base directory site setting. It works fine on Netlify and locally.

My guess is GC isn’t looking out for the multi-package repo scenario, and a change on their end broke that ability?


ERROR Failed to compile: Error: Command failed with ENOENT: lerna bootstrap --registry=<https://registry.npmjs.org/>
spawn lerna ENOENT
AI Update

This question is about Gatsby Cloud build infrastructure and Lerna monorepo configuration, which isn't related to Sanity. You'll want to reach out to Gatsby Cloud support or post in Gatsby-specific communities (like the Gatsby Discord or GitHub discussions) for help with this build issue.

That said, I should mention that Gatsby Cloud has been sunset - Netlify acquired Gatsby and shut down Gatsby Cloud in 2024. If you're still experiencing this issue, you'll need to migrate to another hosting platform.

Since you mentioned your builds work fine on Netlify, I'd recommend completing your migration there. The spawn lerna ENOENT error you're seeing on Gatsby Cloud is likely due to their build environment changes or deprecation-related infrastructure issues that won't be fixed.

For Gatsby projects in general (whether or not they use Sanity), popular hosting options include:

  • Netlify (which you're already using successfully)
  • Vercel
  • Cloudflare Pages

If you're using Sanity as your content source and run into any Sanity-specific issues during your migration or build process (like webhook configuration, GROQ queries, or connecting to the Content Lake), feel free to ask here and we can help. For Gatsby Cloud platform issues, Netlify's support channels would be your best bet.

Show original thread
7 replies
Hey. That should help -&gt; https://www.reddit.com/r/gatsbyjs/comments/11rr2l5/error_failed_to_compile_error_lerna_bootstrap/ TL;DR GC don’t like lerna anymore ^^
Thanks. I did look at that. Their solution was just: stop using Lerna, delete the package.json 😂
I put in a support ticket to push GatsbyCloud to start supporting monorepos again, since they claim to.
If you’re not in a hurry, hopefully you’ll manage to find a solution.I had the same issue and lost so much time because of this ... On the bright side I found out that I wasn’t needing Lerna as much as I thought to
😂 😂 😂That being said it appears from nowhere and don’t even seem to be documented ...
Good luck!
Fair. My pain isn’t immediate, I use Netlify for actual hosting and GatsbyCloud just for previews… only content authors are suffering at the moment. Lerna is more of a nice to have, but I’m trying to keep it.
Looks like more Reddit activity about this problem…

https://www.reddit.com/r/gatsbyjs/comments/12lsji0/lerna_sudden_build_fails/
GatsbyCloud has fixed this issue!
We had a lot of issues when moving from 1.0 to Learna 3 and are now using Learna 6.4.1. I am glad you were able to fix it. We found Netlify worked when Gatsby Cloud did not. We also found Learna had issues adding node modules to the web folder and we had to add them manually to make things work. This is how we structured and it works great on both Gatsby Cloud and Netlify now.
Here are some great additional resources for you too.
* [Publish Multiple Gatsby Sites in a Monorepo, Using Lerna, Travis &amp; Vercel](
https://www.gatsbyjs.com/blog/2019-01-01-publish-multiple-gatsby-sites/ )* [Building a JavaScript Monorepo with Lerna](
https://javascript.plainenglish.io/javascript-monorepo-with-lerna-5729d6242302 )* [@lerna/bootstrap](
https://www.npmjs.com/package/@lerna/bootstrap )* [Lerna Getting Started](
https://lerna.js.org/docs/getting-started )

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?