How to deploy Prisma apps on Hostinger

Fix common Prisma build failures and find which build step failed on Hostinger.

Updated 6 days ago

Prisma apps deploy on Hostinger hosting like any other Node.js app, using the build command from your package.json file. Most Prisma build failures have four causes: the Prisma CLI is only in devDependencies, the Prisma version isn’t pinned, DATABASE_URL is missing at build time, or the Prisma engine is missing. Fix these before deploying, and use the build log to find which step failed.

Build commands for Node.js apps at Hostinger

Hostinger accepts any build command from the scripts section of your package.json file. There’s no list of allowed commands, and you set the build command in the build settings when you add a Node.js web app in Hostinger. For example, npm run build, pnpm build and npx prisma generate && next build all work.

Hostinger installs dependencies with the package manager detected from your lock file. When a lock file exists, npm projects are installed with npm ci.

Prepare a Prisma app for Hostinger

Step 1 – Make the Prisma CLI available during the build

Move prisma from devDependencies to dependencies in package.json if the build log shows prisma: not found. Alternatively, generate the Prisma client automatically after installation:

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

Step 2 – Pin the Prisma version

Set exact versions for prisma and @prisma/client in package.json, for example "prisma": "6.5.0" instead of "prisma": "^6.5.0". An unpinned version can install a newer major version with changed configuration or removed commands.

Step 3 – Add DATABASE_URL for migrations

Add DATABASE_URL as an environment variable if your build runs prisma migrate deploy or prisma db push, as described in how to add environment variables during Node.js application deployment. These commands connect to the database during the build. Use 127.0.0.1 as the host for a Hostinger MySQL database:

DATABASE_URL=mysql://u123456789_user:password@127.0.0.1:3306/u123456789_database

To get these values, see how to find your MySQL database details in Hostinger. For the full database setup, see connecting a Hostinger MySQL database to a Node.js application.

Step 4 – Add the Prisma engine for the server

Add binaryTargets to the generator block in schema.prisma if the app builds but fails at runtime because the Prisma engine is missing:

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.1.x"]
}

Redeploy the Node.js application after these changes.

Find where a Prisma build fails

Open the build log and look at the last command before the error. That command shows which step failed:

  • Installing packages: a dependency problem, such as a version conflict.
  • prisma generate: a problem with the Prisma CLI, schema or version.
  • next build or a similar command: a problem in the app’s own code.

To reproduce the error, run npm ci && npm run build on your own computer with the same Node.js version, as set in how to select the Node.js version for your application. For more on reading build logs, see how to troubleshoot Node.js deployment build errors at Hostinger and how to fix the “Failed to build the application” error in Hostinger Node.js.

With the Prisma CLI available, the version pinned and the database variables set, your Prisma app builds and deploys on Hostinger like any other Node.js app.