Build failed; vite not found

I am deploying a mern app, the frontend is created using vite.js. When I was deploying it it gives an error that vite not found during the execution of npm run build command.

So how we can deploy the app which is created using vite.js?
here are my frontend package.json file scripts:
“scripts”: {
“dev”: “vite”,
“build”: “vite build”,
“lint”: “eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0”,
“preview”: “vite preview”
}

here are the logs of the process of deployment:

backend@1.0.0 build

Feb 24 02:18:23 AM> npm install && npm install --legacy-peer-deps --prefix frontend && npm run build --prefix frontend

Feb 24 02:18:26 AM>added 167 packages, and audited 168 packages in 3s

Feb 24 02:18:26 AM>18 packages are looking for funding

Feb 24 02:18:26 AM> run npm fund for details

Feb 24 02:18:26 AM>found 0 vulnerabilities

Feb 24 02:18:36 AM>added 227 packages, and audited 228 packages in 9s
Feb 24 02:18:36 AM>10 packages are looking for funding

Feb 24 02:18:36 AM run npm fund for details

Feb 24 02:18:36 AM1 moderate severity vulnerability

Feb 24 02:18:36 AM>To address all issues, run:

Feb 24 02:18:36 AM> npm audit fix

Feb 24 02:18:36 AM>Run npm audit for details.
Feb 24 02:18:36 AM> chat-app@0.0.0 build

Feb 24 02:18:36 AM> vite build

Feb 24 02:18:36 AM>sh: 1: vite: not found

Feb 24 02:18:36 AM==> Build failed :disappointed:

Thanks

it would be helpful to see the entire package.json, perhaps shared as a gist or if possible the entire repo, because the error here is vite: not found. which to me would suggest that you have not added vite as a dependency. ensure your package.json has, amoung its other dependancies, vite

“dependencies”: {
“vite”: “^5.1.4”
}

good luck!

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