# npm error Missing script: "build" How to fix it.

URL: https://antideploy.com/blog/npm-error-missing-script-build

A step ran npm run build, and package.json has no build script. Add one, or stop calling it.

**What you see**

```
npm error Missing script: "build"
npm error
npm error To see a list of scripts, run:
npm error   npm run
```

## At a glance

- **What it means**: The script is not defined
- **Fix one**: Add the script
- **Fix two**: Remove the call
- **Static sites**: A build script is required

Published 7 October 2026. Facts checked 7 October 2026. 1 min read.

## What it means

A command in the build ran `npm run build`. npm looked in `package.json` for a script named `build` and found none. The build says it in one sentence: `package.json` has no such script, but the build needs one.

## How to fix it

**Add the script.** Put a `build` script in `package.json` that builds your project, for example `"build": "vite build"` or `"build": "tsc"`.

**Or remove the call.** If your project needs no build, find the command that runs `npm run build` and remove it.

**package.json**

```
{
  "scripts": {
    "build": "vite build",
    "start": "node server.js"
  }
}
```

## Static sites

A frontend that builds to files, such as Vite, Create React App, Astro or Gatsby, needs a `build` script. Without one there is no output folder to serve, and Antideploy tells you so. See [how to deploy a Vite React app](https://antideploy.com/blog/how-to-deploy-a-vite-react-app).

## Script questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto:support@antideploy.com)

### Do server apps need a build script?

Only if they have a build step, such as compiling TypeScript. A plain Node app with a `start` script does not.

### Does this failed deploy cost anything?

No. Failed deploys never count against your plan.

### What should the build script do?

It should compile or bundle your project and then exit. For Vite it is `vite build`, for TypeScript it is `tsc`, and for Next.js it is `next build`.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [How to deploy a Vite React app](https://antideploy.com/blog/how-to-deploy-a-vite-react-app): A Vite app deploys as a free static site. The build, the dist folder, routing and variables.
- [How to deploy a static website for free](https://antideploy.com/blog/how-to-deploy-a-static-website-for-free): Plain HTML or a built frontend. Unlimited, free on every plan, with HTTPS and no card.
- [ERROR: No buildpack groups passed detection](https://antideploy.com/blog/no-buildpack-groups-passed-detection): The builder could not tell the language. No manifest file is at the root of what was sent.

- [Deployments](https://antideploy.com/platform/deployments)
- [Static sites](https://antideploy.com/platform/static-sites)

Facts on this page were checked against the live platform on 7 October 2026.

## Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
