❗️ Vite not found during Vercel deployment – despite working locally

Hey everyone,
I’m trying to deploy a Vue 3 + Vite project to Vercel. Locally everything works fine, but the build on Vercel fails with:

vbnet

sh: line 1: vite: command not found
Error: Command "npm run build" exited with 127

:white_check_mark: What I’ve already tried:

  • vite is installed and works locally (npm run build runs fine)
  • vite is listed in dependencies (not just devDependencies)
  • Using npx vite build as buildCommand → same error
  • vercel.json looks like this:
{
  "buildCommand": "npm run build",
  "outputDirectory": "dist",
  "framework": "vite",
  "rewrites": [
    {
      "source": "/((?!api|favicon\\.ico|robots\\.txt|.*\\.js|.*\\.css|.*\\.svg).*)",
      "destination": "/index.html"
    }
  ]
}

package.json

{
  "name": "vue-bewerbung",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "pdfjs-dist": "^5.1.91",
    "pdfobject": "^2.3.1",
    "vue": "^3.5.13",
    "vue-router": "^4.5.0",
    "vite": "^6.3.5",
    "@vitejs/plugin-vue": "^5.2.2",
    "autoprefixer": "^10.4.21",
    "postcss": "^8.5.3",
    "tailwindcss": "^3.4.17"
  },
  "engines": {
    "node": "20.x"
  }
}

This is a thread that may be helpful: