build: Astro build fails with npm workspaces when triggered by merge

Astro is failing to build when triggered by a merge in an npm workspaces monorepo, but is successful on manual retry. On first build, astro not found error fails the build.

Repo: https://github.com/ayoayco/astro-reactive-library Build settings: Image

One person suggested updating the root to / so that npm i would run in the root and then have a build command to cd apps/landing-page && npm run build. However, this would not work in their case because there are multiple sites that will build.

The other person in the conversation also shared their Astro npm workspaces setup that is working correctly.

Repo: https://github.com/astro-community/astro-embed Build config: — Base directory: Not set — Build command: cd demo && npm run build — Publish directory: demo/dist/

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

@ayoayco I’ve rolled it out to all starter accounts. Can you please confirm that it is solved for you?

@kevinzunigacuellar yeah we have a monorepo doc but it covers yarn and npm workspaces.

I am not exactly sure if this is the way to do it. Any other ideas?

Generally a good idea to run commands from the root directory in a monorepo setup.