Closed TingxunShi closed 3 years ago
Does source/about/index.md
have any content?
Can you try disable external_link:
and run hexo clean && hexo g
?
external_link:
enable: false
i have the same problem!
Does
source/about/index.md
have any content?Can you try disable
external_link:
and runhexo clean && hexo g
?external_link: enable: false
Hi @curbengh , sorry for the late reply. I have something in source/about/index.md
.
I tried to disable external_link
and generation did worked. However when I ran hexo s
and visited localhost:4000, there is nothing in the browser but only a "null" in the top left corner
Does
source/about/index.md
have any content? Can you try disableexternal_link:
and runhexo clean && hexo g
?external_link: enable: false
Hi @curbengh , sorry for the late reply. I have something in
source/about/index.md
.I tried to disable
external_link
and generation did worked. However when I ranhexo s
and visited localhost:4000, there is nothing in the browser but only a "null" in the top left corner
i have the same problem!
Does
source/about/index.md
have any content?Can you try disable
external_link:
and runhexo clean && hexo g
?external_link: enable: false
@curbengh This doesn't work for my case. Turned it off, the error message changed into following:
ERROR Cannot read property 'replace' of null
TypeError: Cannot read property 'replace' of null
at Hexo.externalLinkFilter (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\hexo\lib\plugins\filter\after_render\external_link.js:22:15)
at Hexo.tryCatcher (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\util.js:16:23)
at Hexo.<anonymous> (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\method.js:15:34)
at C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\hexo\lib\extend\filter.js:62:52
at tryCatcher (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\reduce.js:166:18)
at Object.gotAccum (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\reduce.js:155:25)
at Object.tryCatcher (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromiseCtx (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\promise.js:641:10)
at _drainQueueStep (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:97:12)
at _drainQueue (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:439:21)
My package.json
:
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "4.2.0"
},
"dependencies": {
"hexo": "^4.2.0",
"hexo-deployer-git": "^2.1.0",
"hexo-filter-auto-spacing": "^0.2.1",
"hexo-front-matter-excerpt": "^0.2.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-baidu-sitemap": "^0.1.2",
"hexo-generator-category": "^1.0.0",
"hexo-generator-feed": "^2.2.0",
"hexo-generator-index": "^1.0.0",
"hexo-generator-sitemap": "^2.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-asciidoc": "^1.2.2",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^1.0.0"
}
}
I tried to establish Hexo site from scratch but still failed to generate HTMLs because of this issue.
hexo init blog
yarn add hexo-renderer-asciidoc
& resolve the hexo-util
version to "^1.8.1"_config.yml
carefully.When the external_link.enabled
set to true, it failed to generate HTMLs with the following error:
ERROR Render HTML failed: categories/index.html
TypeError: Cannot read property 'replace' of null
at Hexo.externalLinkFilter (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\hexo\lib\plugins\filter\after_render\external_link.js:22:15)
at Hexo.tryCatcher (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\util.js:16:23)
at Hexo.<anonymous> (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\method.js:15:34)
at C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\hexo\lib\extend\filter.js:62:52
at tryCatcher (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\reduce.js:166:18)
at Object.gotAccum (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\reduce.js:155:25)
at Object.tryCatcher (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromiseCtx (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\promise.js:641:10)
at _drainQueueStep (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:97:12)
at _drainQueue (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\GitEnlistments\gitlab.com\zhangshuai-blog\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:439:21)
When the external_link.enabled
set to false, the generation process succeeded, but all index.html content is "null".
My packages.json
:
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "4.2.0"
},
"dependencies": {
"hexo": "^4.0.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-index": "^1.0.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-asciidoc": "^1.2.2",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^1.1.0",
"hexo-server": "^1.0.0",
"hexo-util": "^1.8.1"
},
"resolutions": {
"hexo-renderer-asciidoc/**/hexo-util": "^1.8.1"
}
}
My _config.yml
:
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: ...
subtitle: ''
description: ''
keywords:
author: ...
language: "zh-CN"
timezone: "Asia/Hong_Kong"
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: ...
root: /
permalink: :category/:title/
permalink_defaults:
lang: zh
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
# 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:
- assets/**
# Writing
new_post_name: :year-:month-:day-:title.adoc # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
enable: false # Open external links in new tab
field: site # Apply to the whole site
exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: false
auto_detect: false
tab_replace: ' '
wrap: true
hljs: false
# 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:
# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: 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: YYYY-MM-DD
time_format: HH:mm:ss
## Use post's date for updated date unless set in front-matter
use_date_for_updated: false
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
theme_config:
reminder: false
codeblock:
highlight_theme: night
creative_commons:
license: by-nc-nd
sidebar: true
post: true
language: deed.zh
custom_file_path:
style: source/_data/styles.styl
fancybox: true
footer:
since: 2011
math:
per_page: false
mathjax:
enable: true
menu:
categories: /categories/ || th
tags: /tags/ || tags
about: /about/ || user
pangu: true
sidebar:
position: right
display: post
I already tried hexo clean && hexo g --force
.
I finally found the social links in next config matters. The error would disappear if I remove theme_config.social
.
More specifically, the link without font awesome target matters, for example:
social:
GitHub: http://... || github # This works fine
ZhiHu: http://..... # This matters
Also found hexo-renderer-asciidoc would hit this error, fixed by upgrading it to v2.0.0
I finally found the social links in next config matters. The error would disappear if I remove
theme_config.social
.More specifically, the link without font awesome target matters, for example:
social: GitHub: http://... || github # This works fine ZhiHu: http://..... # This matters
I also find this question!!!
I finally found the social links in next config matters. The error would disappear if I remove
theme_config.social
.More specifically, the link without font awesome target matters, for example:
social: GitHub: http://... || github # This works fine ZhiHu: http://..... # This matters
Great solution!
I finally found the social links in next config matters. The error would disappear if I remove
theme_config.social
.More specifically, the link without font awesome target matters, for example:
social: GitHub: http://... || github # This works fine ZhiHu: http://..... # This matters
i find the same question, and can resolve the question. the hexo-theme-next has the question?
Does
source/about/index.md
have any content? Can you try disableexternal_link:
and runhexo clean && hexo g
?external_link: enable: false
Hi @curbengh , sorry for the late reply. I have something in
source/about/index.md
. I tried to disableexternal_link
and generation did worked. However when I ranhexo s
and visited localhost:4000, there is nothing in the browser but only a "null" in the top left corneri have the same problem!
+1.
I have the same problem too. Have u solve this issue @TingxunShi @yszar
theme-next has the above problem. theme landscape works fine.
The Nunjucks renderer has become part of Hexo, thus I think it is necessary to reconsider this issue. Since Nunjucks returns null instead of an empty string when it encounters a rendering error, some Hexo plugins will throw errors when trying to execute the String.prototype.replace
function. The error message is misleading, and the original error message of Nunjucks is not displayed.
Relevant issues https://github.com/hexojs/hexo/issues/4313 https://github.com/hexojs/hexo/issues/4241
Since Nunjucks returns null instead of an empty string when it encounters a rendering error
We could add a failsafe by returning an empty string.
the original error message of Nunjucks is not displayed.
Help is needed.
@12121-12121 是否方便提供 source/_data/footer.swig
的内容?
我终于在下一个配置问题中找到了社交链接。如果删除,该错误将消失
theme_config.social
。更具体地说,没有字体目标的链接很重要,例如:
social: GitHub: http://... || github # This works fine ZhiHu: http://..... # This matters
您能详细的说一下吗?
@ 12121-12121是否方便提供
source/_data/footer.swig
的内容?
当然。
<script color="88,87,86" opacity="0.5" zIndex="-1" count="125" src="https://cdn.jsdelivr.net/npm/canvas-nest.js@1/dist/canvas-nest.js"></script>
@SukkaW See also https://github.com/mozilla/nunjucks/issues/1272 https://github.com/mozilla/nunjucks/pull/1301
@12121-12121 你遇到的 bug 似乎和这里讨论的问题不同,建议到你新开的 Issue 中讨论 https://github.com/hexojs/hexo/issues/4419
@stevenjoezhang It appears that the newest Nunjucks has been released.
I will bring up a PR to update to latest Nunjucks and bring up a test case accordingly.
Check List
Please check followings before submitting a new issue.
hexo version
to check)Question
Error message below is shown (I'm sure that I have filled in
url:
field in my hexo_config.yml
)Environment & Settings
Node.js & npm version
Your site
_config.yml
(Optional)Your theme
_config.yml
(Optional)Hexo and Plugin version(
npm ls --depth 0
)Your package.json
package.json
Others