Build failure
gikebe
PROOP

18 days ago

Am constantly getting this build failure error:

npm run build

520ms

npm warn config production Use --omit=dev instead.

rest-express@1.0.0 build

vite build && esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist

sh: 1: vite: not found

Build Failed: build daemon returned an error < failed to solve: process "sh -c npm run build" did not complete successfully: exit code: 127 >

Solved$20 Bounty

Pinned Solution

gikebe
PROOP

18 days ago

This was caused by the lockfile being too large. The following are the steps I followed:

Deleted lock file

Then added an environment variable to invalidate the cache NO_CACHE=1

4 Replies

Railway
BOT

18 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway 18 days ago


that's means vite is not installed yet, run npm install or npm ci to install all packages

if you have build command defined, you can just add the install command on it

sh -c npm ci && npm run build


gikebe
PROOP

18 days ago

That doesnt help. Still getting the same error even after deleting lock file and node modules

npm error Exit handler never called!

npm error This is an error with npm itself. Please report this error at:

npm error https://github.com/npm/cli/issues

npm error A complete log of this run can be found in: /root/.npm/_logs/2026-06-19T16_16_58_605Z-debug-0.log

copy / /app

531ms

npm run build

490ms

npm warn config production Use --omit=dev instead.

rest-express@1.0.0 build

vite build && esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist

sh: 1: vite: not found

Build Failed: build daemon returned an error < failed to solve: process "npm run build" did not complete successfully: exit code: 127 >


yashgandhe666
FREE

18 days ago

This is probably not fixed by adding npm ci && npm run build to the build command.

The log shows:


npm warn config production Use --omit=dev instead.

sh: 1: vite: not found

That usually means the build environment is installing production dependencies only, so devDependencies are being skipped. Vite is normally in devDependencies, but it is still required during the build step.

Fix the Docker/build config so the build stage installs dev dependencies before running the build:


COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

Only after the build should you prune/install production deps for the runtime image, e.g. npm ci --omit=dev in a separate runtime stage.

Also check that NODE_ENV=production, NPM_CONFIG_PRODUCTION=true, npm install --production, or npm ci --omit=dev is not being used before npm run build.

Can you share these files/settings?

  1. package.json
  2. Dockerfile or the platform build config
  3. The exact install/build commands configured in the deployment platform
  4. Any non-sensitive env vars set during build, especially NODE_ENV, NPM_CONFIG_PRODUCTION, or NPM_CONFIG_OMIT
  5. The part of the build log before npm run build, especially where dependencies are installed
  6. Whether vite is listed under dependencies or devDependencies

gikebe
PROOP

18 days ago

This was caused by the lockfile being too large. The following are the steps I followed:

Deleted lock file

Then added an environment variable to invalidate the cache NO_CACHE=1


Status changed to Solved passos 17 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...