Help Please,
I’m totally new for the site, trying to deploy my first React/Vite project.
I managed to deploy before successfully but with the blank page with an error message of MIME mismatch, so I deleted it after reading a few blogs in the community here.
I’m now trying to redeploy it with no success. It failes during the ‘Build’, cleans it and exits with failure.
Please check the details below.
In-short, It can’t find ‘vite’ and exits with status code 127.
I tried changing the command to ‘vite build’, installing vite globally, nothing works. The ‘npm run vite’ command works fine locally, also the site works fine on localhost.
- My netlify site name. bookingsocean
Build settings screenshot
- Deploy Log 'Building' Failure log:
8:23:06 AM: Netlify Build
8:23:06 AM: ────────────────────────────────────────────────────────────────
8:23:06 AM:
8:23:06 AM: ❯ Version
8:23:06 AM: @netlify/build 29.21.1
8:23:06 AM:
8:23:06 AM: ❯ Flags
8:23:06 AM: baseRelDir: true
8:23:06 AM: buildId: 65191e49b44105284a1b3380
8:23:06 AM: deployId: 65191e49b44105284a1b3382
8:23:06 AM:
8:23:06 AM: ❯ Current directory
8:23:06 AM: /opt/build/repo
8:23:06 AM:
8:23:06 AM: ❯ Config file
8:23:06 AM: No config file was defined: using default values.
8:23:06 AM:
8:23:06 AM: ❯ Context
8:23:06 AM: production
8:23:06 AM:
8:23:06 AM: Build command from Netlify app
8:23:06 AM: ────────────────────────────────────────────────────────────────
8:23:06 AM:
8:23:06 AM: $ npm run build
8:23:06 AM: > bookings@0.0.1 build
8:23:06 AM: > vite build
8:23:06 AM: sh: 1: vite: not found
8:23:06 AM:
8:23:06 AM: "build.command" failed
8:23:06 AM: ────────────────────────────────────────────────────────────────
8:23:06 AM:
8:23:06 AM: Error message
8:23:06 AM: Command failed with exit code 127: npm run build (https://ntl.fyi/exit-code-127)
8:23:06 AM:
8:23:06 AM: Error location
8:23:06 AM: In Build command from Netlify app:
8:23:06 AM: npm run build
8:23:06 AM:
8:23:06 AM: Resolved config
8:23:06 AM: build:
8:23:06 AM: base: /opt/build/repo
8:23:06 AM: command: npm run build
8:23:06 AM: commandOrigin: ui
8:23:06 AM: environment:
8:23:06 AM: - NODE_ENV
8:23:06 AM: publish: /opt/build/repo/dist
8:23:06 AM: publishOrigin: ui
8:23:08 AM: Failed during stage "building site": Build script returned non-zero exit code: 2
8:23:08 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:23:08 AM: Failing build: Failed to build site
8:23:08 AM: Finished processing build request in 17.783s