admin管理员组文章数量:1316690
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.
本文标签: reactjsVite Build Error Could not load useAuthStore (ENOENT no such file or directory)Stack Overflow
版权声明:本文标题:reactjs - Vite Build Error: Could not load useAuthStore (ENOENT: no such file or directory) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742001124a2411032.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论