I'm trying to deploy my project on Render, but I'm facing an issue during the build process, and I can't seem to figure out the root cause. Here's the error:
[vite:load-fallback] Could not load /opt/render/project/src/frontend/src/store/useAuthStore (imported by src/App.jsx): ENOENT: no such file or directory, open '/opt/render/project/src/frontend/src/store/useAuthStore'
at async open (node:internal/fs/promises:638:25)
at async Object.readFile (node:internal/fs/promises:1238:14)
at async Object.load (file:///opt/render/project/src/frontend/node_modules/vite/dist/node/chunks/dep-M1IYMR16.js:50719:25)
at async PluginDriver.hookFirstAndGetPlugin (file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/node-entry.js:20840:28)
at async file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/node-entry.js:19963:33
at async Queue.work (file:///opt/render/project/src/frontend/node_modules/rollup/dist/es/shared/node-entry.js:21050:32)
What I've Tried
Checked for the file
Checked the
src/store/ directory
, and theuseAuthStore.js
file does exist. The file is committed to GitHub and available in the repository. Checked the import paths:In my
App.jsx
, I have this line:import useAuthStore from './store/useAuthStore';
Since the file doesn't exist, I removed the import entirely, but Vite still seems to reference it during the build.
Cleaned the environment:
- Deleted
node_modules
,.vite
, anddist
folders. - Reinstalled dependencies with
npm install
. - Ran the build locally using
npm run build—it
, works perfectly fine on my machine.
- Deleted
Checked the Render environment:
- Verified that all files are committed to GitHub and there’s no
.gitignore
issue. - The issue only occurs during deployment on Render, not locally.
- Verified that all files are committed to GitHub and there’s no
Ran npm audit fix:
- Addressed several vulnerabilities, but the issue remains.