React app i created using vite has refused to deploy despite it working fine on local host and run build

$ vercel --prod
Vercel CLI 37.12.1
:mag: Inspect: https://vercel.com/undergroundpopulars-projects/eden-farm/AUqpc85utQZ7mPbmnN6Mu5ySTfsD [2s]
:white_check_mark: Production: https://eden-farm-kejmjihu1-undergroundpopulars-projects.vercel.app [2s]
Error: Command “npm run build” exited with 1
Error: Check your logs at Login – Vercel or run vercel logs eden-farm-kejmjihu1-undergroundpopulars-projects.vercel.app

might be a node problem but there is no “engine” in the package.json and the package-lock.json has too many “engines”

this error also shows up
error during build:

08:33:57.877[vite]: Rollup failed to resolve import “/src/main.jsx” from “/vercel/path0/index.html”.

Hi, @undergroundpopular! Welcome to the Vercel Community :raised_hands:

Could you troubleshoot the following?

  • Check package.json:

    • Ensure the build script is correct: "build": "vite build"
    • Add Node.js version specification: "engines": {"node": ">=14.0.0"}
  • Verify project structure:

    • Confirm main.jsx is in the src folder
    • Check index.html for correct script path: <script type="module" src="/src/main.jsx"></script>
  • Update Vite configuration:

    • Create/modify vite.config.js with correct output and resolve settings
  • Review Vercel setup:

    • Check vercel.json configuration (if used)
    • Ensure correct build settings on Vercel dashboard
  • Dependency check:

    • Verify all necessary dependencies are in package.json
  • Clear Vercel cache:

    • Run vercel deploy --force

If issues persist, could you share your project structure, package.json, and full Vercel error logs? Thank you for your patience!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.