我是一个完全的初学者,遵循这本书:https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/
我遵循了书中关于部署到Heroku的说明,并从这里开始:https://luminusweb.com/docs/deployment.html#heroku_deployment,但我遇到了一些问题。
这是我的问题和我采取的步骤。我在这里使用了guestbook-controllers的源代码,并对其进行了修改,只是想让应用程序在Heroku中运行(即能够创建帐户、登录和发布消息)。这是我的回购:https://github.com/johnbradens/guestbook-heroku
以下是我的步骤:
git init
git add .
git commit -m "initial commit"
I added a bin/build file and ran chmod u+x bin/build (based on instructions from https://folcon.github.io/post/2020-04-12-Fulcro-on-Heroku/, because it was saying that react wasn't installed)
I added heroku buildpacks nodejs & clojure (otherwise it said it couldn't read the npm from bin/build)
heroku addons:create heroku-postgresql
git push heroku main这是我看Heroku应用程序时看到的:
当我运行heroku run lein run migrate时,我得到以下错误:
Syntax error compiling at (/tmp/form-init6415984187052473661.clj:1:73).
could not find a non empty configuration file to load. looked in the classpath (as a "resource") and on a file system via "conf" system property我试着编辑env/prod/resources/config.edn,但我不确定该如何处理它。我尝试了很多方法,但都不管用。
下面是我在更改env/prod/resources/config.edn文件时尝试的一个示例。上面的一个链接告诉我只需要{:prod true},所以这就是我现在所拥有的,但我也尝试了:
{:prod true
:port (System/getenv "PORT")
:database-url (System/getenv "JDBC_DATABASE_URL")
}编辑:多亏了clojure松弛,我发现我的env文件夹被忽略了,并创建了一个prod-config.edn文件,其中包含上面的文本。我再次尝试推送Heroku,但仍然收到与web应用程序上的图像相同的错误,当我运行heroku run lein run migrate时,仍然收到相同的错误消息,即未找到配置文件。
我该怎么办?
发布于 2021-09-25 22:43:46
好了,各位,这就是最终修复它的方法。我在github的帖子中发现了这个:https://github.com/luminus-framework/luminus/issues/231
看起来
heroku run lein run migrate是行不通的。
运行生成的jar文件即可完成迁移:
heroku run java -cp target/uberjar/<app name>.jar clojure.main -m guestbook.core migrate把这个留在这里以防其他人也有同样的问题。
https://stackoverflow.com/questions/69328970
复制相似问题