Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地运行主题无法显示 #855

Closed
4bolt opened this issue Apr 2, 2021 · 30 comments
Closed

本地运行主题无法显示 #855

4bolt opened this issue Apr 2, 2021 · 30 comments
Labels
discussion Any questions about this theme.

Comments

@4bolt
Copy link

4bolt commented Apr 2, 2021

确保你在提交Bug反馈之前仔细阅读了Hexo文档Icarus用户指南,和GitHub issues来了解你的问题是否已经被他人提出过。

Bug描述
本地运行hexo 访问http://localhost:4000 主题无效 显示如下

const { Component } = require('inferno'); const classname = require('hexo-component-inferno/lib/util/classname'); const Head = require('./common/head'); const Navbar = require('./common/navbar'); const Widgets = require('./common/widgets'); const Footer = require('./common/footer'); const Scripts = require('./common/scripts'); const Search = require('./common/search'); module.exports = class extends Component { render() { const { site, config, page, helper, body } = this.props; const language = page.lang || page.language || config.language; const columnCount = Widgets.getColumnCount(config.widgets); return
; } };

系统与环境

  • Hexo,操作系统,和Node.js的版本(使用hexo version命令来查看)
    hexo: 5.4.0
    hexo-cli: 4.2.0
    os: Windows_NT 10.0.19041 win32 x64
    node: 12.21.0
    icarus: 4.1.2

  • 站点配置文件_config.yml
    language: zh-CN
    theme: icarus
    其余参数默认

  • 主题配置文件_config.icarus.ymlthemes/icarus/_config.yml
    参数保持默认

  • 浏览器版本(如Firefox 70.0,Chrome Android 80.0)
    Firefox 84.0(64 位)
    版本 89.0.4389.114(正式版本) (64 位)

复现方式
列出复现这个Bug的步骤,如:

  1. 运行‘hexo clean && hexo g && hexo s’
  2. 访问’http://localhost:4000‘
  3. 出现反馈的错误

期望行为
希望告知问题所在 以及解决方法

截图
如果可以的话,请附上几张截图来帮助说明你遇到的问题。
Snipaste_2021-04-03_01-21-36

Snipaste_2021-04-03_00-51-13

额外上下文
采用 npm install hexo-theme-icarus 方式进行安装
没有多余操作
hexo 默认主题运行时没有出现该问题

@4bolt 4bolt changed the title 本地运行 主题无法显示 本地运行主题无法显示 Apr 2, 2021
@ppoffice ppoffice added the discussion Any questions about this theme. label Apr 2, 2021
@ppoffice
Copy link
Owner

ppoffice commented Apr 2, 2021

请移除hexo-renderer-inferno之外的其他hexo renderer插件

@4bolt 4bolt closed this as completed Apr 2, 2021
@4bolt
Copy link
Author

4bolt commented Apr 2, 2021

请移除hexo-renderer-inferno之外的其他hexo renderer插件

node_modules 存在如下hexo renderer插件
Snipaste_2021-04-03_02-10-13
当我删除hexo-renderer-inferno之外的其他hexo renderer插件之后 运行 hexo clean && hexo g && hexo s 出现如下错误
Snipaste_2021-04-03_02-14-24
当我还原这个插件 再运行时访问 http://localhost:4000 出现如下问题
Snipaste_2021-04-03_02-16-22

(不好意思 刚刚手滑 closed 了)

@ppoffice
Copy link
Owner

ppoffice commented Apr 2, 2021

删除ejs那个

@YoYoLikesCiCi
Copy link

同问,按照说明删除renderer之类的包之后,也出现了 cannot GET错误

@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

删除ejs那个

删除 hexo-renderer-ejs 包后 文件夹如下:
Snipaste_2021-04-03_11-49-40

运行 hexo server 本地访问 主题依然无法显示
Snipaste_2021-04-03_00-51-13

只保留 hexo-renderer-inferno hexo-renderer-stylus 时
Snipaste_2021-04-03_11-56-11

运行 hexo server 本地访问 出现 Cannot GET / 错误
Snipaste_2021-04-03_12-08-23

不知是否需要对站点根目录的package.json package-lock.json 以及主题目录 package.json 等文件进行修改

@4bolt 4bolt reopened this Apr 3, 2021
@YoYoLikesCiCi
Copy link

https://www.bilibili.com/video/av71730448/
这个视频教程下的评论也有同样的问题出现

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

@YoYoLikesCiCi
Copy link

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

按此步骤尝试仍然复现

@4bolt 4bolt closed this as completed Apr 3, 2021
@4bolt 4bolt reopened this Apr 3, 2021
@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

按此步骤操作 没有提示安装Icarus的其他依赖 但问题依旧存在 不知其他文件夹里的 hexo-renderer-ejs 包 是否会产生影响

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

按此步骤操作 没有提示安装Icarus的其他依赖 但问题依旧存在 不知其他文件夹里的 hexo-renderer-ejs 包 是否会产生影响

不可能不提示安装其他依赖的。你运行hexo clean时的log是什么?另外,你是否曾经以global的方式安装过什么hexo插件?

@YoYoLikesCiCi
Copy link

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

请尝试新建一个Hexo博客然后测试Icarus是否能正常运行:

hexo init NewBlog
cd NewBlog
npm install hexo-theme-icarus
hexo config theme icarus
hexo clean
// 之后按照提示安装Icarus的其他依赖
// 最后运行
hexo serve

如果可以运行,那么说明你之前使用的主题没有清理干净。

按此步骤操作 没有提示安装Icarus的其他依赖 但问题依旧存在 不知其他文件夹里的 hexo-renderer-ejs 包 是否会产生影响

不可能不提示安装其他依赖的。你运行hexo clean时的log是什么?另外,你是否曾经以global的方式安装过什么hexo插件?

INFO Validating config
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝

INFO === Checking package dependencies ===
INFO === Checking theme configurations ===
WARN None of the following configuration files is found:
WARN - /Users/hisenberg/Blogme/_config.icarus.yml
WARN - /Users/hisenberg/Blogme/node_modules/hexo-theme-icarus/_config.yml
INFO Generating theme configuration file...
INFO /Users/hisenberg/Blogme/_config.icarus.yml created successfully.
INFO To skip configuration generation, use "--icarus-dont-generate-config".
INFO === Registering Hexo extensions ===

@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

hexo serve

Snipaste_2021-04-03_23-11-44

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

hexo serve

Snipaste_2021-04-03_23-11-44

@4bolt Hexo压根没有加载hexo-renderer-inferno这个plugin。而且主题也是加载的landscape而不是icarus。你确定你安装了hexo-theme-icarus并且在_config.yml中更改了theme设置?

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

INFO Validating config

INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
INFO === Checking package dependencies ===
INFO === Checking theme configurations ===
WARN None of the following configuration files is found:
WARN - /Users/hisenberg/Blogme/_config.icarus.yml
WARN - /Users/hisenberg/Blogme/node_modules/hexo-theme-icarus/_config.yml
INFO Generating theme configuration file...
INFO /Users/hisenberg/Blogme/_config.icarus.yml created successfully.
INFO To skip configuration generation, use "--icarus-dont-generate-config".
INFO === Registering Hexo extensions ===

@YoYoLikesCiCi 你也运行下hexo clean --debug然后把完整的log贴出来。

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

作为对照,这里是我运行hexo clean --debug后的log:
image

@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

hexo serve

Snipaste_2021-04-03_23-11-44

@4bolt Hexo压根没有加载hexo-renderer-inferno这个plugin。而且主题也是加载的landscape而不是icarus。你确定你安装了hexo-theme-icarus并且在_config.yml中更改了theme设置?

这个 hexo 配置了 icarus 主题

Snipaste_2021-04-03_23-19-55

@YoYoLikesCiCi
Copy link

YoYoLikesCiCi commented Apr 3, 2021

hisenberg@YoYodeMacBook-Pro   ~/Blogme hexo clean --debug
15:19:20.712 DEBUG Hexo version: 5.4.0
15:19:20.713 DEBUG Working directory: ~/Blogme/
15:19:20.794 DEBUG Config loaded: ~/Blogme/_config.yml
15:19:20.795 INFO  Validating config
15:19:20.804 DEBUG Second Theme Config loaded: ~/Blogme/_config.icarus.yml
15:19:20.829 DEBUG Plugin loaded: hexo-generator-index
15:19:20.829 DEBUG Plugin loaded: hexo-generator-archive
15:19:20.829 DEBUG Plugin loaded: hexo-generator-category
15:19:20.890 DEBUG Plugin loaded: hexo-generator-tag
15:19:20.890 DEBUG Plugin loaded: hexo-server
15:19:20.993 DEBUG Plugin loaded: hexo-renderer-ejs
15:19:20.993 DEBUG Plugin loaded: hexo-renderer-marked
15:19:20.993 DEBUG Plugin loaded: hexo-renderer-stylus
INFO  =======================================
 ██╗ ██████╗ █████╗ ██████╗ ██╗   ██╗███████╗
 ██║██╔════╝██╔══██╗██╔══██╗██║   ██║██╔════╝
 ██║██║     ███████║██████╔╝██║   ██║███████╗
 ██║██║     ██╔══██║██╔══██╗██║   ██║╚════██║
 ██║╚██████╗██║  ██║██║  ██║╚██████╔╝███████║
 ╚═╝ ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO  === Checking package dependencies ===
INFO  === Checking theme configurations ===
INFO  === Registering Hexo extensions ===
15:19:21.298 DEBUG Script loaded: node_modules/hexo-theme-icarus/scripts/index.js
15:19:21.301 INFO  Deleted database.
15:19:21.304 INFO  Deleted public folder.

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

@YoYoLikesCiCi @4bolt 请问你们是通过哪些命令安装的icarus呢?hexo-renderer-inferno这个插件是一定要加载的,否则必然会出现你们一开始提到的主题无法正确渲染的问题。

@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

@YoYoLikesCiCi @4bolt 请问你们是通过哪些命令安装的icarus呢?hexo-renderer-inferno这个插件是一定要加载的,否则必然会出现你们一开始提到的主题无法正确渲染的问题。

npm install hexo-theme-icarus

Snipaste_2021-04-03_23-28-47

npm 版本
Snipaste_2021-04-03_23-30-29

@YoYoLikesCiCi
Copy link

@YoYoLikesCiCi @4bolt 请问你们是通过哪些命令安装的icarus呢?hexo-renderer-inferno这个插件是一定要加载的,否则必然会出现你们一开始提到的主题无法正确渲染的问题。

npm install hexo-theme-icarus

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

@YoYoLikesCiCi @4bolt 那你们在安装完成运行hexo clean后一定会出现如下提示:

image

这时运行上面提示的命令安装依赖就好了

npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3

如果没出现这个提示的话,说明有些依赖之前没有正确安装。

@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3

手动安装该命令

npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3

问题解决 感谢解答

@ppoffice
Copy link
Owner

ppoffice commented Apr 3, 2021

@4bolt 那么之前出现过上面几行提示么?

@YoYoLikesCiCi
Copy link

hisenberg@YoYodeMBP   ~/blog hexo clean --debug
15:43:13.535 DEBUG Hexo version: 5.4.0
15:43:13.536 DEBUG Working directory: ~/blog/
15:43:13.620 DEBUG Config loaded: ~/blog/_config.yml
15:43:13.621 INFO Validating config
15:43:13.644 DEBUG Plugin loaded: hexo-generator-archive
15:43:13.644 DEBUG Plugin loaded: hexo-generator-category
15:43:13.644 DEBUG Plugin loaded: hexo-generator-index
15:43:13.644 DEBUG Plugin loaded: hexo-generator-tag
15:43:13.755 DEBUG Plugin loaded: hexo-renderer-ejs
15:43:13.755 DEBUG Plugin loaded: hexo-renderer-marked
15:43:13.755 DEBUG Plugin loaded: hexo-renderer-stylus
15:43:13.755 DEBUG Plugin loaded: hexo-server
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝

INFO === Checking package dependencies ===
INFO === Checking theme configurations ===
WARN None of the following configuration files is found:
WARN - /Users/hisenberg/blog/_config.icarus.yml
WARN - /Users/hisenberg/blog/node_modules/hexo-theme-icarus/_config.yml
INFO Generating theme configuration file...
INFO /Users/hisenberg/blog/_config.icarus.yml created successfully.
INFO To skip configuration generation, use "--icarus-dont-generate-config".
INFO === Registering Hexo extensions ===
15:43:13.961 DEBUG Script loaded: node_modules/hexo-theme-icarus/scripts/index.js

问题解决,重新建了一个文件夹,按最开始的说明尝试,clean 日志如上 ,并没有出现提示,手动npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3 安装后解决问题

@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

@4bolt 那么之前出现过上面几行提示么?

第一次安装的时候没印象了(-_-) 但是后面安装一直没有出现提示

@ppoffice ppoffice closed this as completed Apr 3, 2021
@4bolt
Copy link
Author

4bolt commented Apr 3, 2021

补充 :

发现执行命令

npm install hexo-theme-icarus

会在 node_modules 下生成文件夹 hexo-renderer-inferno

Snipaste_2021-04-04_00-44-41

但是执行以下

hexo clean

并没有加载 hexo-renderer-inferno 也没有提示缺失依赖

Snipaste_2021-04-04_00-27-49

执行

npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3

再执行以下

hexo clean

依赖 hexo-renderer-inferno 加载成功 主题渲染

@ppoffice ppoffice pinned this issue May 6, 2021
@gaycookie
Copy link

npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3

手动安装该命令

npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3

问题解决 感谢解答

Thank you so much, costed me some time to read all this since I do not understand chinese!
But thanks to you, my install is now working!

@lucasjinreal
Copy link

Runing npm install --save bulma-stylus@0.8.0 hexo-renderer-inferno@^0.1.3 solved problem, I think npm install hexo-theme-icarus is missleading in readme.

Just clone it to themes folder as every other theme does might avoid this problem.

@tzzs
Copy link

tzzs commented Oct 18, 2021

I'm having the same problem when icarus and there are no alerts. Maybe a note could be added to the documentation.

@ppoffice
Copy link
Owner

ppoffice commented Oct 18, 2021

Repository owner locked as resolved and limited conversation to collaborators Oct 18, 2021
@ppoffice ppoffice unpinned this issue Jul 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion Any questions about this theme.
Projects
None yet
Development

No branches or pull requests

6 participants