# Build failed

> build_failed and no_build_script — the build command ended with an error. The common causes and the fix.

Source: https://livops.dev/en/docs/error-build

`build_failed` — the build command (`npm run build`, `mvn package`, `cargo build`) ended with an error. The cause is nearly always in the code: run `npm run build` on your machine and it stops in the same place. The previous version keeps running.

## `no_build_script`: the build command calls a script that is not there

`package.json` has no `build` script, but the build command calls it. Fix the command in **Settings → Build** or clear it — most server applications need no build.

## A TypeScript error

The log has lines like `error TS2307`, `TS2345`. The code has a type error. Run `npm run build` locally, fix it, push.

## The Prisma client was not generated

The log says `Cannot find module '.prisma/client'` or `generated/prisma`. When the project has `prisma` and `prisma/schema.prisma`, we run `prisma generate` before the build ourselves. Otherwise add to `package.json`:

```json
"scripts": {
  "postinstall": "prisma generate"
}
```

## The build ran out of memory

For a Node build, add to **Variables**:

```text
NODE_OPTIONS=--max-old-space-size=2048
GENERATE_SOURCEMAP=false
```

In Next.js, `productionBrowserSourceMaps: false`. If it is still not enough, write to us.

## SvelteKit reads a variable while building

Variables from `$env/static/...` are needed at build time. Add the one the log names in **Variables** and deploy again.

## `FROM openjdk:...` in the Dockerfile

The `openjdk` images were removed from Docker Hub. Use `eclipse-temurin` with the same version:

```dockerfile
FROM eclipse-temurin:17-jre
```

## `microsoft/dotnet` in the Dockerfile

These images moved to Microsoft's own registry:

```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/aspnet:8.0
```

## The Dockerfile's image no longer exists

The image on the `FROM` line was removed or renamed. Use an image and tag that exist today.

## The Gradle wrapper is too old

Gradle before version 5 needs Java 8; we have Java 11, 17 and 21. Update the wrapper and commit the `gradle/` folder:

```sh
gradle wrapper --gradle-version 8.14
```

## The Go module has no `main` package

It is a library, not a program. Set **Root folder** to the program's folder (for example `cmd/server`), or deploy the repository of the program that uses this module.
