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

Bug 回报:Linux上的谜之启动错误(TypeError: Cannot read properties of undefined (reading 'main')) #171

Closed
zh-jp opened this issue Jan 5, 2023 · 7 comments
Assignees
Labels
🐛bug Something isn't working help wanted Extra attention is needed

Comments

@zh-jp
Copy link

zh-jp commented Jan 5, 2023

  1. 报告前须知
  • [ √] 我确认该Bug是可复现的,我会根据下面的模板提供完整详尽的复现步骤
  • [ √] 我确认已认真阅读 ReadMe.md 和文档,确认描述的内容有误或是不能解决我的问题
  • [ √] 我已知晓如果没有认真阅读且勾选这里所有的条目,或是没有使用此模板认真详细地描述问题,是对彼此时间的浪费,我的 issue 可能会被无解释关闭
  1. 对Bug的描述:
    一模一样的config文件和nodejs版本,但是运行在Linux平台上会概率报错,但landscape主题能正常运行。

  2. 复现Bug的方法:
    我在windows上编写并测试了config文件,运行在Linux上会报错,而且不是每次都发生错误。。。之前挂载在上面的时候发生报错,但更换主题为landscape时能运行,切回本主题时居然又能运行了,所以没有太过在意。
    但今天故技重施,结果启动不了

  3. 期望的行为:
    希望每次能顺利运行,就像Windows上一样!

  4. 相关的截图:
    image

  5. 运行环境(如果该Bug的产生和环境有关,例如浏览器不兼容导致):

  • 操作系统: Linux
  1. 您的配置文件:
theme: kratos-rebirth # 大概率运行不了
theme: landscape # 正常启动
  1. 补充内容:
    谢谢作者,拜托!拜托!
@ArcticLampyrid ArcticLampyrid added 🐛bug Something isn't working help wanted Extra attention is needed ⚠fatal Fatal problems labels Jan 5, 2023
@ArcticLampyrid
Copy link
Collaborator

一直在Linux镜像下自动构建,未遇到过类似问题
考虑发一下您的具体配置信息吗?

@zh-jp
Copy link
Author

zh-jp commented Jan 5, 2023

版本信息:

Linux version 3.10.0-1160.80.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Tue Nov 8 15:48:59 UTC 2022

内核信息:

Linux VM-12-6-centos 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

_config.yml

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

# Site
title: XXX
subtitle: XXX
description: ''
keywords:
author: zh_jp2022@outlook.com
language: zh-CN
timezone: Asia/Shanghai

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: 
permalink: :year/:month/:day/:title/
permalink_defaults:
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:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # 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: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: false
  preprocess: true
  line_number: true
  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:

# 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
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'

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

theme: landscape
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: ''

_config.kratos-rebirth.yml

site_logo: /images/siteLogo.webp
avatarUri: /images/avatar.webp

topMenu:
  - label: 首页
    icon: home
    url: /
  - label: 档案馆
    icon: file
    url: /archives/
  - label: 好伙伴
    icon: pase
    url: /friends/
  - label: 链接
    icon: link
    submenu:
      - label: 作者博客
        url: https://XXXX
      - label: 项目链接
        url: https://github.com/zh-jp

vendors:
  # 常用CDN基地址:
  # https://unpkg.com/
  # https://cdn.jsdelivr.net/npm/

  # 以下一行代码指定 npm cdn 基地址,该 CDN 应该兼容 jsdelivr 使用的路径格式
  # npm_cdn: https://cdn.jsdelivr.net/npm/
  packages:
    hexo-theme-kratos-rebirth: 
      # 以下一行代码用于对某个包单独配置 cdn 基地址,使用 null 表示不从 cdn 获取此包
      # cdn_url: null
      # cdn_url: https://cdn.jsdelivr.net/npm/hexo-theme-kratos-rebirth@latest/
    aplayer:
      # 以下一行代码指定所使用的库版本
      # 默认情况下会使用主题开发组进行开发调试时所使用的版本(通常而言也是最适合的版本)
      # 因此该值不建议修改
      # 
      # 注意:如果选择其他版本,则必须配置 npm_cdn 或 为包单独配置 cdn_url 或 修改 vendors 目录,
      # 这是因为主题自带的库只含有默认版本,必须从 cdn 加载其他版本或由用户手动提供其他版本的相关文件
      #
      # 警告:随意切换版本可能造成主题无法正常工作
      # 
      # version: 1.10.1
      files:
        "dist/APlayer.min.css":
          # 以下代码用于单独对某个文件进行映射,以便于使用不符合 jsdelivr 路径格式的CDN(或其他特殊情形)
          # 使用 null 表示不重定向(默认行为)
          # relocate: null
          # relocate: https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css

          # 以下代码用于指定 SRI 以增强安全性
          # 注意,仅有部分组件支持 SRI,不支持的组件会忽略此值
          # integrity: sha256-6Y7CJDaltoeNgk+ZftgCD9jLgmGv4xKUo8nQ0HgAwVo=

friends:
  list:
  - name: "猫猫①号"
    bio: "喵~"
    avatar: "../images/avatar.webp"
    link: "https://candinya.com"
  - name: "猫猫②号"
    bio: "喵喵~"
    avatar: "../images/avatar.webp"
    link: "https://candinya.com"
  - name: "猫猫⑨号"
    bio: "咪啪~"
    avatar: "../images/avatar.webp"
    link: "https://candinya.com"

# Post Page 文章页配置
posts:
  show_cc: false
  donate: true
  share: true
  comments: 
    provider: gitalk

gitalk:
  clientID: d36fb9e52XXXXXXXX
  clientSecret: 59a38ceXXXXXXXXX
  repo: gitalk-comments
  owner: zh-jp
  admin: 
    - zh-jp
  distractionFreeMode: false
contact:
  weibo: 
  mail: zh_jp2022@outlook.com 
  twitter:  
  linkedin: 
  telegram: 
  fediverse:
    instance: 
    username: 
  github: zh-jp

timenotice: 
icp: 这是icp的位置
psr: 这是psr的位置

@ArcticLampyrid
Copy link
Collaborator

手动添加以下内容到 _config.kratos-rebirth.yml 试试
虽然理论上有默认值才对

jsconfig:
  main:
    cover:
      randomAmount: 20 # 表示从1~20
      baseUrl: null # 使用默认值(不单独配置),将跟随 vendors 中的相关设定选择是否使用 cdn
      filenameTemplate: "thumb_{no}.webp" 
    createTime: "2018/05/06 17:03:12"
    donateBtn: "支持我~"
    scanNotice: "扫一扫,好不好?"
    qr_alipay: "/images/alipayqr.webp"
    qr_wechat: "/images/wechatpayqr.webp"
    siteLeaveEvent: false
    leaveTitle: "{{{(>_<)}}}哦哟,崩溃啦~"
    returnTitle: "(*´∇`*)欸,又好啦~"
    copyrightNotice: "该内容采用 CC BY-NC-SA 4.0 许可协议,著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。"
    expire_day: 30
    topNavScrollToggle: true

@zh-jp
Copy link
Author

zh-jp commented Jan 5, 2023

神了,真的可以(虽然不敢保证下次会不会再犯)
大佬能讲解下原理吗

@zh-jp
Copy link
Author

zh-jp commented Jan 5, 2023

非常感谢您的回复!

@ArcticLampyrid
Copy link
Collaborator

报错是缺少xxx配置项,所以加上试试
但理论上 Kratos-Rebirth 目录下还有一个 _config.yml 来做 fallback 才对,具体细节可能需要进一步的分析
您的安装方式是?clone到themes目录下还是通过npm的?

@zh-jp
Copy link
Author

zh-jp commented Jan 5, 2023

使用的npm

@ArcticLampyrid ArcticLampyrid removed the ⚠fatal Fatal problems label Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants