Back to documentation
Deployment

Advanced: Render Build Commands (Self-Hosting)

For developers self-hosting a copy: what the build command does and why the default is npm ci --include=dev && npm run build.

This guide is optional reading for developers who self-host a copy on their own Render account. 9orb hosts your product by default and manages builds for you.

Every deployment on Render starts with a build: Render pulls the code and runs a build command that installs dependencies and compiles the app into its production form.

The default

For self-hosted copies, the render.yaml 9orb generates uses:

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.
  • `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 the 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.

When the build command is the problem

  • "npm ci can only install with an existing package-lock.json": the lockfile is missing 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.
  • 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`. They are visible to anyone using the site (never put secrets in them), and changing them requires a redeploy for the new value to reach the browser.

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