Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failing with Exit Code 127 - Vite Not Found #2412

Open
alpsla opened this issue Nov 15, 2024 · 0 comments
Open

Build Failing with Exit Code 127 - Vite Not Found #2412

alpsla opened this issue Nov 15, 2024 · 0 comments

Comments

@alpsla
Copy link

alpsla commented Nov 15, 2024

Describe the bug

The build process is consistently failing with exit code 127, indicating that the vite command is not found during the build process. Here are the specific details:

Current Behavior:

  • Build fails with error: "sh: 1: vite: not found"
  • Exit code 127 is returned
  • Error occurs during the npm run build step

Environment Details:

  • Node version: 20
  • Build command: npm install && npm run build
  • Framework: Vite + React + TypeScript
  • Deploy settings:
    • Base directory: /
    • Build command: npm install && npm run build
    • Publish directory: dist

Link to the Bolt URL that caused the error

https://bolt.new/~/sb1-yn7aou

Steps to reproduce

Steps to Reproduce:

  1. Push changes to the repository
  2. Netlify attempts to build the site
  3. Build fails after npm install, when trying to execute vite build

Relevant Configuration Files:

package.json:

{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "typecheck": "tsc --noEmit"
  },
  "devDependencies": {
    "@vitejs/plugin-react": "^4.2.1",
    "vite": "^5.0.12"
    // ... other dependencies
  }
}

netlify.toml:

[build]
  command = "npm install && npm run build"
  publish = "dist"

[build.environment]
  NODE_VERSION = "20"
  NPM_FLAGS = "--legacy-peer-deps"
  NODE_ENV = "production"

Error Log:

10:17:29 PM: > [email protected] build
10:17:29 PM: > vite build
10:17:29 PM: sh: 1: vite: not found

### Expected behavior

npm install should install all dependencies, including Vite
- vite build command should be available and execute successfully
- Build should complete and deploy the site

### Screen Recording / Screenshot

_No response_

### Platform

Browser name = Chrome
Full version = 130.0.0.0
Major version = 130
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
performance.memory = {
"totalJSHeapSize": 279102224,
"usedJSHeapSize": 260989468,
"jsHeapSizeLimit": 4294705152
}
Username = alpsla
Chat ID = ff7732ad13c7


### Additional context

Things Already Tried:
1. Updated build command to include explicit install
2. Verified Vite is in devDependencies
3. Confirmed Node version is set correctly
4. Added NPM_FLAGS with --legacy-peer-deps

Additional Context:
The build process seems to be unable to find the vite executable even though it's listed in devDependencies and should be installed during the npm install step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant