Back to documentation
Deployment

Understanding Render Build Commands

Learn what the build command does, why the default is npm ci --include=dev && npm run build, and when to change it.

Every deployment on Render starts with a build: Render pulls your code from GitHub and runs a build command that installs dependencies and compiles the app into its production form. Idea to Life sets this up for you, but understanding it helps you read logs and fix problems.

The default

For projects the platform generates, the build command is:

npm ci --include=dev && npm run build

Two steps, joined by && so the second only runs if the first succeeds:

  • `npm ci` installs the exact dependency versions recorded in package-lock.json. Unlike `npm install`, it never quietly upgrades anything, which makes builds reproducible: the versions that worked in the AI build are the versions used in production.
  • `npm run build` runs the project's build script — for Next.js projects, `next build` — which compiles TypeScript, bundles the frontend, and pre-renders pages.

Where to see it

In the Render dashboard, open your service and go to Settings; the build command is listed there and you can edit it. Build output appears in the Logs tab for every deploy, which is the first place to look when a deploy fails.

When the build command is the problem

Common build-stage failures and what they mean:

  • "npm ci can only install with an existing package-lock.json": the lockfile is missing or was deleted from the repository. Restore it or (less ideal) switch to `npm install`.
  • Type errors or "Module not found" during `npm run build`: a code problem, not a Render problem. Fix through a change request or a commit; during platform builds, the automatic repair loop handles most of these before you ever see them.
  • Out-of-memory during build: large projects can exceed the memory of small instance types during compilation. Render offers larger build resources on paid plans.

Environment variables at build time

Variables prefixed with NEXT_PUBLIC_ are baked into the frontend bundle during `npm run build`. Two consequences: they are visible to anyone using your site (never put secrets in them), and changing them requires a redeploy, not just a restart, for the new value to appear in the browser.

When to customize

You rarely need to. Legitimate reasons include adding a database migration step before the build, using a different package manager if you have taken over the repository and switched to pnpm or yarn, or adding a code-generation step. If you edit the command in Render directly, note that a future platform-managed rebuild may reset service settings to match the blueprint — prefer requesting the change through Idea to Life so it is recorded and preserved.

Rule of thumb: the build command should be deterministic. Same code in, same site out, every time. `npm ci` exists precisely to guarantee that.