xaoxuu / hexo-theme-stellar

内置文档系统的简约商务风Hexo主题,支持大量的标签组件和动态数据组件。
https://xaoxuu.com/wiki/stellar/
MIT License
1.26k stars 313 forks source link

不确定是stellar 或者 hexo 问题,无法正常启动 HEXO #371

Closed johnbao6 closed 7 months ago

johnbao6 commented 7 months ago

安装目录 Hexo 是正常的,添加剂stellar 似乎也是正常的。 重新启动仪式 linux 服务器,出现了如下错误:

ERROR Render HTML failed: index.html
Error: /home/bao/Desktop/openctex/node_modules/hexo-theme-stellar/layout/index.styl:1:9
   1| @import 'partial/*'
--------------^
   2| @import 'tag-plugins/*'
   3| @import 'sidebar/*'
   4| @import 'widgets/*'

failed to locate @import file partial/*.styl
github-actions[bot] commented 7 months ago

:wave: Hello, Please describe your problem in as much detail as possible. If you don’t know how to describe the problem in detail, this article can help you: How To Ask Questions The Smart Way.

:wave: 您好, 请尽可能详细地描述您的问题。如果不知道如何详细地描述问题,这份教程可以帮助到您:提问的智慧

xaoxuu commented 7 months ago

看看 package.json ?

xaoxuu commented 7 months ago

描述有点看不懂,是用机器翻译的吗?如果您的母语不是中文,发英文描述也可以的。

johnbao6 commented 7 months ago

谢谢 xaoxuxu。

我感觉更大可能是 stellar 问题而非 hexo 问题。因为当我在 _config.yml 改回 theme: landscape 时一切都正常了, 但是改成 theme: stellar 时问题就出现了, 这时浏览器 http://localhost:4000/ 没有反馈。而在后台出现如下错误:

bao@bao-macbookair72  ~/Desktop/openctex  hexo server INFO Validating config INFO Welcome to Stellar 1.26.3 DOCS https://xaoxuu.com/wiki/stellar/ REPO https://github.com/xaoxuu/hexo-theme-stellar.git

INFO Start processing INFO Hexo is running at http://localhost:4000/ . Press Ctrl+C to stop. ERROR Render HTML failed: index.html Error: /home/bao/Desktop/openctex/node_modules/hexo-theme-stellar/layout/index.styl:1:9 1| @import 'partial/' --------------^ 2| @import 'tag-plugins/' 3| @import 'sidebar/' 4| @import 'widgets/'

failed to locate @import file partial/*.styl

at Evaluator.visitImport (/home/bao/Desktop/openctex/node_modules/stylus/lib/visitor/evaluator.js:911:23)
at Evaluator.visit (/home/bao/Desktop/openctex/node_modules/stylus/lib/visitor/index.js:29:42)
at Evaluator.visit (/home/bao/Desktop/openctex/node_modules/stylus/lib/visitor/evaluator.js:154:20)
at Evaluator.visitRoot (/home/bao/Desktop/openctex/node_modules/stylus/lib/visitor/evaluator.js:703:29)
at Evaluator.visit (/home/bao/Desktop/openctex/node_modules/stylus/lib/visitor/index.js:29:42)

......

重新安装 stellar 问题依旧。 另外 package.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": "7.1.1" }, "dependencies": { "hexo": "^7.0.0", "hexo-generator-archive": "^2.0.0", "hexo-generator-category": "^2.0.0", "hexo-generator-index": "^3.0.0", "hexo-generator-tag": "^2.0.0", "hexo-renderer-ejs": "^2.0.0", "hexo-renderer-marked": "^6.0.0", "hexo-renderer-stylus": "^3.0.0", "hexo-server": "^3.0.0", "hexo-theme-landscape": "^1.0.0", "hexo-theme-stellar": "^1.26.3" } }

希望得到您的帮助,谢谢!

xaoxuu commented 7 months ago

我还是看不出来哪里有问题,你可以试一下 demo 看看能否运行,我这边试了是正常的: https://github.com/xaoxuu/hexo-stellar-starter.git

xaoxuu commented 7 months ago
image

Error: /home/bao/Desktop/openctex/node_modules/hexo-theme-stellar/layout/index.styl:1:9 这个文件路径有点奇怪,它是不存在的,并且不符合 stellar 的源文件结构,下面是正常的结构:

image

如图所示, layout 文件夹下面都是 *.ejs 文件,而 *.styl 文件则位于 /source/css/* 中。

xaoxuu commented 7 months ago

我想问一下你是按照文档中的这两个步骤进行安装的吗?有没有进行额外的操作?

image

https://xaoxuu.com/wiki/stellar/#%E5%AE%89%E8%A3%85%E4%B8%8E%E6%9B%B4%E6%96%B0

johnbao6 commented 7 months ago

谢谢 Xaoxuu.

您说的这些要点,我应该都尝试或注意到了。但问题似乎还是不太清楚。

一、 有一个 安装路径的问题我一直都没有特别搞清楚(hexo 官网似乎也没有解释),我也不知道对不对。我是这样做的:

  1. 安装 hexo 是这样做的: 在我的个人 home 目录下,也就是 命令 cd 回到的路径下,即 /home/bao 下运行: npm install -g hexo-cli

  2. 安装目录stellar 也是在同样的路径下运行: npm i hexo-theme-stellar

  3. 然后在桌面路径下,也就是 /home/bao/Desktop 下运行:(注意:这儿的路径与前面两步不一样,我这样做的目的打开桌面就可以看到这一步产生的文件夹,我不确信这一步是正确的,但是在缺省 theme下没有问题) hexo init openctex 这一步会在桌面上生成一个文件夹 openctex。

  4. 在路径 /home/bao/Desktop/openctex 运行启动 hexo 的命令: hexo server

至此一切似乎都是正常的,如果使用缺省 theme: landscape (_config.yml 没有改动) 的话。 但是 当我改动为 theme: stellar 后,再次启动 hexo server 后,浏览器似乎就无法访问了,具体的错误信息在前面我报告了。

二、 除此之外,我的另外一个操作可能也会导致上面问题,但是我不清楚原因:

我在另外一台电脑(也是同样的 linux 系统)上,写好了几篇博客。 我直接把几篇博客文章 .md 文件直接复制到新电脑的这个路径下面: /home/bao/Desktop/openctex/source/_posts 我不知道这样做是否对,但是在缺省的主题—— landscape 下是可以正确显示的。

我浏览比较了多个 theme,感觉器官 stellar 的外观是我喜欢的,另外它的支持也是比较好的。所以选了这个主题。

Xaoxuu 应该 stellar 的开发者吧,谢谢您!

johnbao6 commented 7 months ago

我试着重新安装 stellar,但是没有删除老的安装。但是问题依旧。

不知道怎样才能彻底重新安装 stellar?不需要先把 hexo 删掉也要重新安装吧?

xaoxuu commented 7 months ago

你应该需要在 /home/bao/Desktop/openctex 里面执行 npm i hexo-theme-stellar 而不是别的地方。(和 hexo server 在相同的路径中)

xaoxuu commented 7 months ago

或者如果你有 macOS 电脑的话,也可以尝试使用我的脚本,在一个你想要放置博客源码的位置新建一个空白文件夹,然后在其中执行:

curl -s https://sh.xaox.cc/install | sh -s blog && blog init

注意:需要输入一次密码。脚本的文档:https://xaoxuu.com/wiki/cloud-shell/blog/ 如果顺利的话不到一分钟就能看到博客的预览页面了

johnbao6 commented 7 months ago

谢谢!

按照您的建议,在新的目录下重新安装 stellar,问题仍旧一样,:-C。 可能要先把老的安装先删除。

xaoxuu commented 7 months ago

我发的demo可以运行吗

xaoxuu commented 7 months ago

克隆starter的仓库,然后进入blog文件夹

johnbao6 commented 7 months ago

您的 demo 可以使用。

我是下载下来,解压缩,然后按照您说的两步,最后用浏览器可以使用。

johnbao6 commented 7 months ago

我把安装目录 openctex 删了(博客先做了备份),然后

  1. hexo init openctex

  2. 进入 openctex 目录,npm i hexo-theme-stellar

  3. 在 _congfig.yml 中更改 theme: stellar

  4. 把备份的博客添加回去

  5. hexo server

现在应该正常了!

谢谢 Xaoxuu 的细心帮忙!

xaoxuu commented 7 months ago

不客气 👍

github-actions[bot] commented 7 months ago

:wave: Hello, This issue has been marked as resolved. If there are other issues, please contact us with a new issue.

:wave: 您好, 此 issue 已经被标记为已解决,如果还有其它问题,请提出新的 issue 联系我们。

songtianlun commented 4 months ago

https://github.com/xaoxuu/hexo-theme-stellar/issues/377#issuecomment-2078481853

xaoxuu commented 4 months ago

这个问题统一都在这个 issue 中跟进吧:https://github.com/xaoxuu/hexo-theme-stellar/issues/372#issuecomment-2077824363