Hexo-theme-next: Having trouble migrating from 5.1.4 to the 6.0+ version 升级新版无法渲染

Created on 26 Oct 2019  ·  10Comments  ·  Source: theme-next/hexo-theme-next

Please check if your Issue fulfills the following requirements.
请务必确认您在提交此 Issue 前已经查看并完成了下列检查单中的所有事项。

Issue Checklist

  • [x] I have executed hexo clean, cleared the browser cache and disabled all CDN services (e.g. Cloudflare Rocket Loader), this issue still exists.
  • [x] I have confirmed that this issue only appears in theme NexT, but cannot be reproduced in other themes (e.g. default theme landscape). In other words, prove that this is a NexT issue, not a issue from Hexo.
  • [x] I have already viewed NexT Documentation Site and Hexo Docs page, especially Troubleshooting part.
  • [x] I have already viewed the latest Roadmap on GitHub and searched for current issues, which does not help me.

Expected behavior

Following https://github.com/theme-next/hexo-theme-next/blob/master/docs/zh-CN/UPDATE-FROM-5.1.X.md
直接克隆

$ git clone https://github.com/theme-next/hexo-theme-next themes/next-reloaded

更改主题为 next-reloaded

期待可以直接升级使用6.0+ 版本

Actual behavior

  • Links to demo site with this issue: N/A
  • Links to repository or source code of the blog: N/A

Steps to reproduce the behavior

  1. hexo clean 过 旧版主题验证没有问题
  2. 出现 Unhandled rejection Template render error -> TypeError: str.replace is not a function
  3. 尝试过修改 文章的 tag 部分,v5.1.4 似乎不要求 tag 的 - 前面需要有空格 但所有文章加了空格后似乎还是报错 (我忘了报错内容是否完全相同 似乎有所减少 怀疑有其他地方需要在 - 前面加空格???)

Environment Information

Node.js and NPM Information

v11.1.0
6.12.0

Package dependencies Information

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.9.0"
  },
  "dependencies": {
    "hexo": "^3.9.0",
    "hexo-asset-image": "git+https://github.com/CodeFalling/hexo-asset-image.git",
    "hexo-cli": "^1.1.0",
    "hexo-deployer-git": "^0.2.0",
    "hexo-generator-archive": "^0.1.5",
    "hexo-generator-baidu-sitemap": "^0.1.6",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-index": "^0.2.1",
    "hexo-generator-sitemap": "^1.2.0",
    "hexo-generator-tag": "^0.2.0",
    "hexo-renderer-ejs": "^0.2.0",
    "hexo-renderer-marked": "^0.2.10",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-server": "^0.2.2",
    "hexo-wordcount": "^3.0.2",
    "jquery": "^3.4.1"
  }
}%

Hexo Version

hexo: 3.9.0
hexo-cli: 3.1.0
os: Darwin 17.4.0 darwin x64
http_parser: 2.8.0
node: 11.1.0
v8: 7.0.276.32-node.7
uv: 1.23.2
zlib: 1.2.11
ares: 1.14.0
modules: 67
nghttp2: 1.34.0
napi: 3
openssl: 1.1.0i
icu: 62.1
unicode: 11.0
cldr: 33.1
tz: 2018e

Hexo Configuration

# 前 20 行隐去,hiding first 20 lines

# 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:

# 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
# theme: next
theme: next-reloaded

# Deployment
## Docs: https://hexo.io/docs/deployment.html
# deploy:
#   type: git
#   repo: http://github.com/monster-gump/monster-gump.github.io.git
#   branch: master
#   message: "Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}"

include:
  - .nojekyll

# hexo sitemap
sitemap:
  path: sitemap.xml
baidusitemap:
  path: baidusitemap.xml

NexT Configuration

# 看了一下应该没有什么要紧的地方
# My changes here shouldn't matter, will provide if get asked

Other Information

完整错误信息 在 hexo g 或者 hexo s 被访问时出错

Unhandled rejection Template render error: (../themes/next-reloaded/layout/index.swig)
  Template render error: (../themes/next-reloaded/layout/index.swig)
  Template render error: (../themes/next-reloaded/layout/index.swig) [Line 8, Column 10]
  Template render error: (../themes/next-reloaded/layout/index.swig)
  Template render error: (../themes/next-reloaded/layout/_partials/head/head-unique.swig) [Line 12, Column 26]
  Template render error: (../themes/next-reloaded/layout/index.swig)
  Template render error: (../themes/next-reloaded/layout/index.swig)
  Template render error: (../themes/next-reloaded/layout/_partials/header/index.swig) [Line 3, Column 10]
  Template render error: (../themes/next-reloaded/layout/_partials/header/menu.swig) [Line 19, Column 26]
  Template render error: (../themes/next-reloaded/layout/_partials/header/menu.swig) [Line 27, Column 13]
  TypeError: str.replace is not a function
    at Object.exports.prettifyError (../node_modules/nunjucks/src/lib.js:34:15)
    at ../node_modules/nunjucks/src/environment.js:486:31
    at new_cls.root [as rootRenderFunc] (eval at _compile (../node_modules/nunjucks/src/environment.js:565:24), <anonymous>:41:3)
    at new_cls.render (../node_modules/nunjucks/src/environment.js:479:15)
    at ../themes/next-reloaded/scripts/renderer.js:32:29
    at Theme._View.View._compiled.locals [as _compiled] (../node_modules/hexo/lib/theme/view.js:123:48)
    at Theme._View.View.View.render (../node_modules/hexo/lib/theme/view.js:29:15)
    at ../node_modules/hexo/lib/hexo/index.js:349:21
    at tryCatcher (../node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at ../node_modules/hexo/node_modules/bluebird/js/release/method.js:15:34
    at RouteStream._read (../node_modules/hexo/lib/hexo/router.js:123:3)
    at RouteStream.Readable.read (_stream_readable.js:452:10)
    at resume_ (_stream_readable.js:899:12)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)

Discussion Question Solved

Most helpful comment

Issue-Label Bot is automatically applying the label Question to this issue, with a confidence of 0.68. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

All 10 comments

Thanks for opening this issue, maintainers will get back to you as soon as possible!

Issue-Label Bot is automatically applying the label Question to this issue, with a confidence of 0.68. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

理论上文章的front matter不会造成这样的渲染错误。建议先使用全新的NexT主题(7.5.0版本),再逐步地把自己原有的配置和自定义内容迁移到新版本。

无法根据已有信息debug,请提供博客全部源代码(非渲染后的代码)

你好,我也有这个问题,最新版 next,是使用 hexo-generator-sitemap 这个 hexo 插件造成的,卸载掉 hexo-generator-sitemap 就没问题了,我现在的问题就是使用了 next 主题后 hexo 生成不了 sitemap,试过其它主题是可以生成的,就 next 不行,这是我的代码 代码

同样的问题,同样的错误,不知你解决了吗

这几个版本改动挺大的。如果要升级的话,建议先 clone 一个全新的主题,然后再逐步将旧主题中自定义的内容迁移过来。每次修改后执行 hexo clean && hexo s,这样如果报错,可以快速定位到问题。

我就是直接clone最新版本下来打算逐步迁移,可是在未做任何改动的情况下,根本无法渲染打开

我就是直接clone最新版本下来打算逐步迁移,可是在未做任何改动的情况下,根本无法渲染打开

移除sitemap插件不行吗?是插件的问题

hexo-generator-sitemap 2.0.0 版本不报错,不排除是与其它插件冲突了。

Was this page helpful?
0 / 5 - 0 ratings