Hexo: Heroku deployment with wrong port

Created on 26 Aug 2019  ·  2Comments  ·  Source: hexojs/hexo

Check List

Please check followings before submitting a new issue.

  • [x ] I have already read Docs page & Troubleshooting page
  • [x ] I have already searched existing issues and they are not help to me
  • [x ] I examined error or warning messages and it's difficult to solve
  • [x ] Node.js is higher than 6.9

Question

I am trying to deploy Hexo on Heroku. I first tried to force in package.json "start": "hexo server -p 80" but Heroku won't allow that. Then, from here I found hexo-deployer-heroku which I installed. It created a folder .deploy_heroku/ that didn't work because it was starting everything with nginx and Heroku needed the package.json file. I moved the package.json file there and changed the procfile back to "web: hexo server" but then here is the Heroku log after running hexo deploy:

2019-08-26T09:05:22.985726+00:00 heroku[web.1]: Starting process with command hexo server
2019-08-26T09:05:26.162852+00:00 app[web.1]: INFO Start processing
2019-08-26T09:05:26.177569+00:00 app[web.1]: INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
2019-08-26T09:06:23.539056+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-26T09:06:23.427688+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-08-26T09:06:23.428091+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-08-26T09:06:23.515599+00:00 heroku[web.1]: Process exited with status 137

And of course accessing the website doesn't show anything. So, how do I deploy Hexo on Heroku? I really tried everything and this is frustrating because nothing seem to work.

Environment & Settings

Node.js & npm version

v9.6.1

Your site _config.yml (Optional)

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Hexo
subtitle:
description:
keywords:
author: John Doe
language: en
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: heroku
  repo: https://git.heroku.com/MYREPO.git
  message: 

Your theme _config.yml (Optional)


Hexo and Plugin version(npm ls --depth 0)

├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Your package.json package.json

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.9.0"
  },
  "scripts": {
    "test": "",
    "start": "hexo server"
  },
  "dependencies": {
    "hexo": "^3.9.0",
    "hexo-deployer-heroku": "^0.1.2",
    "hexo-generator-archive": "^0.1.5",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-index": "^0.2.1",
    "hexo-generator-tag": "^0.2.0",
    "hexo-renderer-ejs": "^0.3.1",
    "hexo-renderer-marked": "^1.0.1",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-server": "^0.3.3"
  }
}

Others

Most helpful comment

Hi @masiarb You might be able to open the server using the $PORT environment variable. But also they have some kind of static site hosting there too.

Someone wrote a guide on our deploy page you might like:
https://hexo.io/docs/deployment#Heroku

Heroku has some other instructions in case that doesn't work.
https://devcenter.heroku.com/articles/static-sites-ruby

Will you write back if you solve the problem?

All 2 comments

Hi @masiarb You might be able to open the server using the $PORT environment variable. But also they have some kind of static site hosting there too.

Someone wrote a guide on our deploy page you might like:
https://hexo.io/docs/deployment#Heroku

Heroku has some other instructions in case that doesn't work.
https://devcenter.heroku.com/articles/static-sites-ruby

Will you write back if you solve the problem?

I'll take your silence as a sign I solved the problem! 🤗

Was this page helpful?
0 / 5 - 0 ratings