My React + Vite app runs in local but not in Vercel #7622
Replies: 1 comment
-
This discussion was automatically closed because the community moved to vercel.community |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Acknowledgement
Question
Hello Vercel Community,
I am facing an issue with deploying my project on Vercel. The project works perfectly on my local machine, but when I try to deploy it on Vercel, the build fails with the following error:
What I have tried:
Installed dependencies: I made sure to install all the dependencies locally using npm install and the app works fine on my local machine.
Vercel Build Process: When I run npm run build locally, it works without any issues and outputs the build files into the correct directory (e.g., dist).
Deleting and Redeploying: I deleted the previous Vercel deployment and redeployed the app, but the issue persists.
Module Path Issue: I have checked the import paths, and everything seems correct. The react-router-dom is installed as a dependency and is being correctly imported in App.jsx.
No Cache Available: The Vercel logs show that there is no previous build cache available, which I assume should not affect the deployment, but I’m not sure.
Environment:
Framework: Vite
React: Version 18
react-router-dom: Version 6
Vercel Deployment: The project fails during the build process when deployed via Vercel, but works locally.
Request:
I would greatly appreciate any suggestions or solutions to resolve this issue. It seems that Vercel is unable to resolve the react-router-dom module, but I don’t face this problem locally.
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions