Build error: An unexpected error happened when running this build.

Here’s the build output:

Build Completed in /vercel/output [1m]

Deploying outputs…

An unexpected error happened when running this build. We have been notified of the problem. This may be a transient error. If the problem persists, please contact Vercel Support https://vercel.com/help

Okay. Tried switching to bun from pnpm and result was:

Error: Turbopack build failed with 1 errors:
./node_modules/@libsql/hrana-client/LICENSE:1:5
Parsing ecmascript source code failed

1 | MIT License
| ^^^^^^^
2 |
3 | Copyright 2023 the sqld authors
4 |

Expected ‘;’, ‘}’ or

So I then customized the build command to “bun next build” to overwride script with “–turbopack“. It got built.

Now that I learned the issue was with turbopack and libsql, I switched back to pnpm and made the same change, but to pnpm, “pnpm next build”, to overwride turbopack script. It worked as expected.

So the issue was with @libsql/hrana-client and turbopack. As pnpm didn’t gave the error, bun was necessary to identify the error. So pnpm can’t identify the issue but problably vercel can.