Hexo: error when i run 'hexo g'

Created on 1 Sep 2020  ·  4Comments  ·  Source: hexojs/hexo

Check List

Please check followings before submitting a new issue.

  • [√] I have already read Docs page & Troubleshooting page
  • [√] I have already searched existing issues and they are not help to me
  • [√] I examined error or warning messages and it's difficult to solve
  • [√] Using the latest version of Hexo (run hexo version to check)
  • [√] Node.js is higher than minimum required version

Question

Environment & Settings

Node.js & npm version

# node -v
v12.18.3

# npm -v
6.14.6

Your site _config.yml (Optional)

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

# Site
title: xtzero
subtitle: xt
description: 从前从前,有个人爱你很久
keywords: xt zero
author: xt
language: zh_cn
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: /
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: true
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: Chic

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type:

Your theme _config.yml (Optional)

# html lang
language: zh

# Header
navname: xtLifeBlog of xtzero.me

# navigatior items
nav:
  首页: /
  文章: /archives
  分类: /category
  标签: /tag
  关于: /about
  次元门: http://xtzero.me

# favicon
favicon: https://tvax4.sinaimg.cn/crop.0.0.1080.1080.180/e9021108ly8g2qxtpraroj20u00u0ade.jpg

# Profile
nickname: xt

### this variable is MarkDown form.
description: 从前从前,有个人爱你很久.
avatar: https://tvax4.sinaimg.cn/crop.0.0.1080.1080.180/e9021108ly8g2qxtpraroj20u00u0ade.jpg

# main menu navigation
## links key words should not be changed.
## Complete url after key words.
## Unused key can be commented out.
links:
  #  Blog: /
  #  Category:
  #  Tags:
  Link: http://xtzero.me
  #  Resume:
  #  Publish:
  #  Trophy:
  #  Gallary:
  #  RSS:
  #  AliPay:
  #  ZhiHu:
  #  LinkedIn:
  #  FaceBook:
  #  Twitter:
  #  Skype:
  #  CodeSandBox:
  #  CodePen:
  #  Sketch:
  #  Gitlab:
  #  Dribble:
  #  Instagram:
  #  Reddit:
  #  YouTube:
  #  QQ:
  Weibo: https://weibo.com/xtzero2
  #  WeChat:
  Github: https://github.com/xtzero

# how links show: you have 2 choice--text or icon.
links_text_enable: false
links_icon_enable: true

# Post page
## Post_meta
post_meta_enable: true

post_author_enable: true
post_date_enable: true
post_category_enable: true
## Post copyright
post_copyright_enable: false

post_copyright_author_enable: false
post_copyright_permalink_enable: false
post_copyright_license_enable: false
post_copyright_license_text: Copyright (c) 2019 <a href=" ">CC-BY-NC-4.0</a > LICENSE
post_copyright_solgan_enable: false
post_copyright_solgan_text: 从前从前,有个人爱你很久
## toc
post_toc_enable: true

# Page
page_title_enable: true

# 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: Y-M-D
time_format: H:i

# stylesheets loaded in the <head>
stylesheets:
  - /css/style.css

# scripts loaded in the end of the body
scripts:
  - /js/script.js


# plugin functions
## Mathjax: Math Formula Support
## https://www.mathjax.org
mathjax:
  enable: true
  import: demand # global or demand
  ## global: all pages will load mathjax,this will degrade performance and some grammers may be parsed wrong.
  ## demand: Recommend option,if your post need fomula, you can declare 'mathjax: true' in Front-matter

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

npm ls --depth 0
[email protected] /data/www/blog/life
├── [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": "5.1.1"
  },
  "dependencies": {
    "hexo": "^5.1.1",
    "hexo-asset-image": "^1.0.0",
    "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": "^3.1.0",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-server": "^0.3.3"
  }
}

Others

i used jenkins for ci/cd, when i run 'hexo g' today, i saw error information on my termail.

ERROR {
  err: TypeError [ERR_INVALID_URL]: Invalid URL: http://
      at onParseError (internal/url.js:256:9)
      at new URL (internal/url.js:332:5)
      at new URL (internal/url.js:329:22)
      at /data/www/blog/life/node_modules/hexo/node_modules/hexo-util/lib/full_url_for.js:22:18
      at Cache.apply (/data/www/blog/life/node_modules/hexo/node_modules/hexo-util/lib/cache.js:27:46)
      at Hexo.fullUrlForHelper (/data/www/blog/life/node_modules/hexo/node_modules/hexo-util/lib/full_url_for.js:18:16)
      at _Document.<anonymous> (/data/www/blog/life/node_modules/hexo/lib/models/post.js:53:25)
      at _Document.permalink (/data/www/blog/life/node_modules/warehouse/lib/types/virtual.js:59:24)
      at _Document.toObject (/data/www/blog/life/node_modules/warehouse/lib/document.js:73:44)
      at _Model._insertOne (/data/www/blog/life/node_modules/warehouse/lib/model.js:157:25)
      at /data/www/blog/life/node_modules/warehouse/lib/model.js:179:63
      at tryCatcher (/data/www/blog/life/node_modules/bluebird/js/release/util.js:16:23)
      at /data/www/blog/life/node_modules/bluebird/js/release/using.js:185:26
      at tryCatcher (/data/www/blog/life/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/data/www/blog/life/node_modules/bluebird/js/release/promise.js:517:31)
      at Promise._settlePromise (/data/www/blog/life/node_modules/bluebird/js/release/promise.js:574:18)
      at Promise._settlePromise0 (/data/www/blog/life/node_modules/bluebird/js/release/promise.js:619:10)
      at Promise._settlePromises (/data/www/blog/life/node_modules/bluebird/js/release/promise.js:699:18)
      at Promise._fulfill (/data/www/blog/life/node_modules/bluebird/js/release/promise.js:643:18)
      at PromiseArray._resolve (/data/www/blog/life/node_modules/bluebird/js/release/promise_array.js:126:19)
      at PromiseArray._promiseFulfilled (/data/www/blog/life/node_modules/bluebird/js/release/promise_array.js:144:14)
      at Promise._settlePromise (/data/www/blog/life/node_modules/bluebird/js/release/promise.js:579:26) {
    input: 'http://',
    code: 'ERR_INVALID_URL'
  }

i tried to upgrade my node and npm version, but not work.

question

Most helpful comment

@YoshinoriN @curbengh

Should we validate config.url during validate_config?

All 4 comments

@xtzero

Please set your website url in _config.yml.

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

Thank you :)

@YoshinoriN @curbengh

Should we validate config.url during validate_config?

👍

Should we validate config.url during validate_config?

+1 ❤️

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomap picture tomap  ·  21Comments

pod4g picture pod4g  ·  24Comments

fabien-h picture fabien-h  ·  22Comments

curbengh picture curbengh  ·  21Comments

JackieLuo picture JackieLuo  ·  45Comments