I'm trying to deploy my Laravel Vue.js project (with Inertia.js) on heroku.
But when it executes vite build
it gives this error:
-----> Build
Running build
> build
> vite build
vite v3.1.1 building for production...
transforming...
✓ 90 modules transformed.
[vite:load-fallback] Could not load /resources/js/Components/Modals/FormModal.vue (imported by resources/js/Pages/Admin/Classrooms/Modals/CreateClassroomModal.vue): ENOENT: no such file or directory, open '/resources/js/Components/Modals/FormModal.vue'
error during build:
Error: Could not load /resources/js/Components/Modals/FormModal.vue (imported by resources/js/Pages/Admin/Classrooms/Modals/CreateClassroomModal.vue): ENOENT: no such file or directory, open '/resources/js/Components/Modals/FormModal.vue'
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I've already tried to set the node.js version in the package.json
to the same version that I use locally (16.x), but still gives this error.
In the CreateClassroomModal.vue
file the import looks like this:
import FormModal from "@/Components/Modals/FormModal.vue";
And the file /resources/js/Components/Modals/FormModal.vue
really exists in the project.
When I try to compile everything locally (with npm run build
) everything works fine and there are no errors.
What causes the problem that my resources can't be compiled?
I've fixed the problem.
The problem was that on Github the folder names was /resources/js/components/...
and locally /resources/js/Components/...
(with a uppercase). I don't know how this ever happened, but it's fixed 👍