Next.js build fails in production but succeeds on local
felixngfender
HOBBYOP

4 months ago

On this line:

.../libpq@1.8.15/node_modules/libpq install: sh: 1: node-gyp: not found

$10 Bounty

3 Replies

Railway
BOT

4 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


starphoneswebtech
PRO

4 months ago

Hey, can you show the full error log?


felixngfender
HOBBYOP

4 months ago

Of course

```
[Region: us-east4]

╭─────────────────╮

│ Railpack 0.12.0 │

╰─────────────────╯

↳ Found .dockerignore file, applying filters

↳ Detected Node

↳ Using pnpm package manager

Packages

──────────

node │ 25.2.1 │ mise.toml (25.2.1)

pnpm │ 9.15.9 │ railpack default (9)

Steps

──────────

▸ install

$ pnpm install --frozen-lockfile --prefer-offline

▸ build

$ pnpm build

Deploy

──────────

$ pnpm start

Successfully prepared Railpack plan for build

context: h756-

load build definition from railpack-plan.json

0ms

copy mise.toml

225ms

install mise packages: node, pnpm

2s

Trust them with mise trust. See https://mise.jdx.dev/cli/trust.html for more information.

mkdir -p /app/node_modules/.cache

225ms

copy package.json, pnpm-lock.yaml, .npmrc

125ms

pnpm install --frozen-lockfile --prefer-offline

14s

mise WARN Config files in /app/mise.toml are not trusted.

Trust them with mise trust. See https://mise.jdx.dev/cli/trust.html for more information.

Lockfile is up to date, resolution step is skipped

Progress: resolved 1, reused 0, downloaded 0, added 0

Packages: +1119

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Progress: resolved 1119, reused 0, downloaded 3, added 0

Progress: resolved 1119, reused 0, downloaded 270, added 266

Progress: resolved 1119, reused 0, downloaded 569, added 574

Progress: resolved 1119, reused 0, downloaded 776, added 786

Progress: resolved 1119, reused 0, downloaded 1064, added 1081

Progress: resolved 1119, reused 0, downloaded 1094, added 1113

Progress: resolved 1119, reused 0, downloaded 1095, added 1113

Progress: resolved 1119, reused 0, downloaded 1099, added 1116

Progress: resolved 1119, reused 0, downloaded 1100, added 1119, done

.../node_modules/@tailwindcss/oxide postinstall$ node ./scripts/install.js

.../sharp@0.34.3/node_modules/sharp install$ node install/check.js

.../esbuild@0.25.0/node_modules/esbuild postinstall$ node install.js

.../esbuild@0.18.20/node_modules/esbuild postinstall$ node install.js

.../esbuild@0.25.0/node_modules/esbuild postinstall: Done

.../sharp@0.34.3/node_modules/sharp install: Done

.../node_modules/@tailwindcss/oxide postinstall: Done

.../sharp@0.34.1/node_modules/sharp install$ node install/check

.../esbuild@0.18.20/node_modules/esbuild postinstall: Done

.../core-js@3.45.1/node_modules/core-js postinstall$ node -e "try{require('./postinstall')}catch(e){}"

.../sharp@0.34.1/node_modules/sharp install: Done

.../node_modules/protobufjs postinstall$ node scripts/postinstall

.../core-js@3.45.1/node_modules/core-js postinstall: Done

.../libpq@1.8.15/node_modules/libpq install$ node-gyp rebuild

.../esbuild@0.25.9/node_modules/esbuild postinstall$ node install.js

.../node_modules/protobufjs postinstall$ node scripts/postinstall

.../libpq@1.8.15/node_modules/libpq install: sh: 1: node-gyp: not found

.../node_modules/protobufjs postinstall: Done

.../node_modules/protobufjs postinstall: Done

.../esbuild@0.25.9/node_modules/esbuild postinstall: Done

.../sharp@0.34.5/node_modules/sharp install$ node install/check.js || npm run build

.../sharp@0.34.5/node_modules/sharp install: Done

.../es5-ext@0.10.64/node_modules/es5-ext postinstall$ node -e "try{require('./_postinstall')}catch(e){}" || exit 0

.../es5-ext@0.10.64/node_modules/es5-ext postinstall: Done

 ELIFECYCLE  Command failed.

copy /mise/shims, /mise/installs, /usr/local/bin/mise, /etc/mise/config.toml, /root/.local/state/mise, /app/mise.toml

1s

ERROR: failed to build: failed to solve: process "pnpm install --frozen-lockfile --prefer-offline" did not complete successfully: exit code: 1

```


Loading...