我尝试通过以下命令创建 Macchiato 的空白应用程序(ClojureScript 模板):
lein new macchiato abc
cd abc
git init
heroku create
git add --all
git commit -m "Initial"
git push heroku master
heroku run lein package
但是应用程序崩溃了。
我应该怎么做才能在免费的 Heroku 上运行 Macchiato/ClojureScript 空白应用程序?
来自 Heroku 的一些日志:
2017-09-20T14:20:18.982364+00:00 heroku[web.1]: Starting process with command `node target/release/abc.js`
2017-09-20T14:20:21.393478+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-09-20T14:20:23.735706+00:00 app[web.1]: INFO [abc.core:19] - abc started on 127.0.0.1 : 46297
2017-09-20T14:21:19.612740+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-09-20T14:21:19.612805+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-09-20T14:21:19.765958+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-20T14:21:19.754144+00:00 heroku[web.1]: Process exited with status 137
2017-09-20T14:21:20.199389+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=calm-sea-65041.herokuapp.com request_id=538fbec8-6d9a-4a9c-8ee6-682d2ae18ee4 fwd="194.186.207.221" dyno= connect= service= status=503 bytes= protocol=https
2017-09-20T14:21:20.932872+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=calm-sea-65041.herokuapp.com request_id=74269aea-639d-41b8-8c76-4bb0494eb593 fwd="194.186.207.221" dyno= connect= service= status=503 bytes= protocol=https
2017-09-20T14:21:22.963835+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=calm-sea-65041.herokuapp.com request_id=08a421a1-03a0-4e27-8efe-e4209e249e9a fwd="194.186.207.221" dyno= connect= service= status=503 bytes= protocol=https
最佳答案
这应该是问题的根源
2017-09-20T14:20:23.735706+00:00 app[web.1]: INFO [abc.core:19] - abc started on 127.0.0.1 : 46297
该应用程序仅监听 127.0.0.1,但是,heroku 希望您的应用程序监听 0.0.0.0。
添加环境变量HOST
,值为0.0.0.0
应该可以解决问题。
关于node.js - 如何将 macchiato clojurescript 应用程序部署到 Heroku 免费帐户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46318646/