You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git添加的Ghost CMS Heroku新主题不显示,本地正常如何解决

解决Heroku上Ghost主题不显示的问题

我之前也碰到过一模一样的情况——本地主题列表正常,部署到Heroku后就找不到了,重启dyno和重新部署都没用。下面是几个亲测有效的解决方法,你可以按顺序试试:

1. 先确认主题真的被部署到Heroku了

有时候可能是主题文件夹没被加入Git提交,先在本地仓库检查:

git status

如果content/themes/你的主题文件夹名显示为未跟踪状态,赶紧提交推送:

git add content/themes/你的主题文件夹名
git commit -m "添加新主题"
git push heroku main

然后登录Heroku的dyno验证文件是否存在:

heroku run ls -la /app/content/themes -a 你的Heroku应用名

替换你的Heroku应用名后执行,确认主题文件夹出现在列表里。

2. 清除Ghost缓存,强制重新扫描主题

Heroku上的Ghost可能缓存了旧的主题列表,需要手动清除缓存触发重新扫描:

  1. 进入Heroku的交互式bash环境:
heroku run bash -a 你的Heroku应用名
  1. 切换到Ghost的根目录(通常是/app),执行缓存清除命令:
ghost cache clear
  1. 可以再执行主题列表命令,确认是否能识别到新主题:
ghost theme list
  1. 退出bash环境:
exit

3. 针对性重启Ghost进程

有时候重启整个dyno可能没触碰到Ghost的进程,试试单独重启web进程:

heroku restart web -a 你的Heroku应用名

如果还是不行,进入dyno手动杀死Ghost进程(Heroku会自动重启它):

heroku run bash -a 你的Heroku应用名
ps aux | grep node  # 找到Ghost对应的进程ID
kill <进程ID>
exit

4. 检查Ghost生产环境配置

确认config.production.json里的主题路径配置正确:

heroku run cat /app/config.production.json -a 你的Heroku应用名

查看paths部分,确保themes指向正确的路径,比如:

"paths": {
  "contentPath": "content",
  "themes": "content/themes"
}

如果以上方法都试过还是不行,建议查看Ghost的日志,看看有没有主题加载相关的错误提示:

heroku logs --tail -a 你的Heroku应用名

内容的提问来源于stack exchange,提问作者Graeme Paul

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 11:05:56