[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# Build error deploying a Svelte project to Prod (Preview builds fine)

252 views · 11 likes · 16 posts


BMG (@elterman) · 2025-03-13

error during build:
```txt
Error: Could not resolve peer dependency "svelte/compiler" relative to your project — please install it and try again.
at resolve_peer_dependency (file:///vercel/path0/node_modules/@sveltejs/kit/src/utils/import.js:20:10)
at async file:///vercel/path0/node_modules/@sveltejs/kit/src/core/sync/utils.js:7:21
Error: Command "npm run build" exited with 1
```

Used to work fine. Cannot understand what changed. The AI assistant says the error is unexpected.


Amy Egan (@amyegan) · 2025-03-13

It looks like there's a missing dependency, but I don't know enough about your project to say why that's happening. Do you have a public repo or a [minimal reproducible example](https://vercel.com/guides/creating-a-minimal-reproducible-example) that I can use to help you debug?


BMG (@elterman) · 2025-03-14 · ♥ 1

Thank you, Amy.

The public repo is at https://github.com/elterman/Worded-Well. Preview builds and deploys fine, and the local build runs without an issue as well. The problem is with the Prod build. It started happening today after a totally innocent code change. Thank you for looking into it.

EDIT: Well, now Preview build fails as well, same error.

EDIT2: Seems to be working now. BTW, I created a new project linked to the same repo, deployment worked at first, then stopped working, now it's working again – in both projects. Go figure.


Amy Egan (@amyegan) · 2025-03-14 · ♥ 1

Please let me know if deployments stop working again. I hope they're all good now!


BMG (@elterman) · 2025-03-14

They intermittently fail, especially when run from the CLI (but not only). But I found that if I request "Redeploy" from the website, it usually works.


Paul Sammut (@paulesammut) · 2025-03-15

Having exactly the same problem. It started yesterday. It deploys successfully 2 or 3 times before starting to fail, even without code changes. Deleting the project and recreating it by running vercel on the command line seems to "reset" it, i.e. it deploys successfully 2 or 3 times again, then starts to fail. Just tried again now after 20 or so hours and it again repeated that process - a couple of successful deployments, now failing again. The svelte/compiler dependency cannot be installed manually, it is part of svelte itself.

Hitting the redeploy button in the UI succeeds, which I guess is the workaround for now.

EDIT: Actually, it's intermittent


Eric Jarvis (@jarvisworks) · 2025-03-16 · ♥ 2

elterman & Paul, thanks for the tip about redeploying via the ui. I was able to get a successful build for the first time in days by redeploying.


Amy Egan (@amyegan) · 2025-03-17

Do you all get the same `Could not resolve peer dependency "svelte/compiler"` error every time?


BMG (@elterman) · 2025-03-17

I do get the same error every time.


Amy Egan (@amyegan) · 2025-03-17 · ♥ 1

I was finally able to repro using @elterman's repo (thanks for sharing it). I could only make it happen on a preview deployment from GitHub. The fact that it tends to work after a redeploy made me think it could be a build cache issue, but it seems to work even if I redeploy with the original build cache :confused: 

Tried to [disable the build cache](https://vercel.com/docs/deployments/troubleshoot-a-build#managing-build-cache) anyway, and I couldn't make the error happen again after that. Tried to re-enable the build cache and got errors again right away. But it doesn't happen every time so that could just be a coincidence.

Deploying from local with the CLI also didn't run into errors any of the times I tried it. So possible workarounds include disabling the build cache (add env var `VERCEL_FORCE_NO_BUILD_CACHE=1`) or using CLI to deploy.

I'm sharing all of this with the internal team so we can dig into the root cause, but I wanted to at least give you a workaround so you don't keep seeing build errors


BMG (@elterman) · 2025-03-17

Thank you, Amy. I just tried to deploy Preview from the CLI, got the error. Haven't tried disabling the cache yet.


Paul Sammut (@paulesammut) · 2025-03-17

YES. Always same error. And it is still happening frequently, i.e. around 50% of the time for me. Has not once failed on redeploy from UI though.

Will try disable the cache when my too many deploys breach times out ;)


Paul Sammut (@paulesammut) · 2025-03-17 · ♥ 2

Thanks Amy! Workaround VERCEL_FORCE_NO_BUILD_CACHE-1 works!


BMG (@elterman) · 2025-03-17 · ♥ 2

Indeed it does. Thank you, Amy.


Amy Egan (@amyegan) · 2025-03-19 · ♥ 1

We shipped a build cache update related to this issue. 

If you re-enable build cache and give it a try, please let me know whether or not the dependency error happens again. Everything should be working normally now.


BMG (@elterman) · 2025-03-19 · ♥ 1

It does work. Both Preview and Production. Thank you!