在 Heroku Post Build 期间,找不到文件 [英] During Heroku Post Build, Cannot find file
问题描述
这是一个 React 应用程序,具有样式化组件,通过 git push heroku master
This is a react application, with styled components, with a Node backend being deployed to Heroku via git push heroku master
我使用 import {...} from './style'
从单独的文件中导入每个组件的样式.
I import the style for each component from a separate file with import {...} from './style'
.
文件结构在哪里:
OptionsCarousel|index.js|style.js
这对我来说非常有意义,并且可以通过 npm start
和 npm run build -> 在本地工作.服务 -s 构建
.没有问题.但是在部署到 Heroku 时,在优化构建阶段,它失败并显示错误:
This makes perfect sense to me, and works locally both via npm start
and npm run build -> serve -s build
. With no issues. But when deploying to Heroku, during the optimization build stage, it fails with the error:
<代码>远程:创建优化的生产构建...远程:编译失败.偏僻的:远程:./src/OptionsCarousel/index.js远程:在./src/OptionsCarousel"中找不到文件./style".
任何有关构建此问题的更好方法的建议以及导致此问题的原因将不胜感激.
Any advice on a better way to structure this, and what is causing the issue would be greatly appreciated.
推荐答案
根据@Andy 的评论,我需要清除缓存,因为我对存储库中的文件结构进行了重大更改.我按照这些说明来做到这一点.
As per @Andy's comment, I needed to clear the cache as I had made significant changes to the file structure in the repository. I followed these instructions to do that.
这篇关于在 Heroku Post Build 期间,找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!