heroku 无法加载模块“”(由“”导入)“:ENOENT:没有这样的文件或目录,打开“”

kulphzqa  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(313)

我正在尝试在heroku上部署我的Laravel Vue.js项目(带有Inertia.js)。
但当它执行vite build时,它会给出以下错误:

-----> 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

我已经尝试将package.json中的node.js版本设置为本地使用的版本(16.x),但仍然出现此错误。
CreateClassroomModal.vue文件中,导入如下所示:

import FormModal from "@/Components/Modals/FormModal.vue";

并且文件/resources/js/Components/Modals/FormModal.vue确实存在于项目中。
当我尝试在本地编译所有内容时(使用npm run build),所有内容都运行良好,没有错误。是什么导致了我的资源无法编译?

0wi1tuuw

0wi1tuuw1#

"我已经解决了这个问题"
问题是Github上的文件夹名是/resources/js/components/...,而本地是/resources/js/Components/...(大写)。我不知道这是怎么发生的,但它已经修复了👍

相关问题