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

Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. #1161

Closed
JIeJaitt opened this issue Dec 14, 2022 · 2 comments
Labels
bug:general Issues with this theme in general.

Comments

@JIeJaitt
Copy link

Bug描述
使用 hexo g 之后出现的

Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info.

系统与环境

  • Hexo,操作系统,和Node.js的版本(使用hexo version命令来查看)
NFO  Validating config
Inferno is in development mode.
INFO  =======================================
 ██╗ ██████╗ █████╗ ██████╗ ██╗   ██╗███████╗
 ██║██╔════╝██╔══██╗██╔══██╗██║   ██║██╔════╝
 ██║██║     ███████║██████╔╝██║   ██║███████╗
 ██║██║     ██╔══██║██╔══██╗██║   ██║╚════██║
 ██║╚██████╗██║  ██║██║  ██║╚██████╔╝███████║
 ╚═╝ ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO  === Checking package dependencies ===
INFO  === Checking theme configurations ===
INFO  === Registering Hexo extensions ===
hexo: 6.3.0
hexo-cli: 4.3.0
os: darwin 22.1.0 13.0.1

node: 16.17.1
v8: 9.4.146.26-node.22
uv: 1.43.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.18.1
modules: 93
nghttp2: 1.47.0
napi: 8
llhttp: 6.0.9
openssl: 1.1.1q+quic
cldr: 41.0
icu: 71.1
tz: 2022a
unicode: 14.0
ngtcp2: 0.1.0-DEV
nghttp3: 0.1.0-DEV
  • 站点配置文件_config.yml
title: 未来可妻
subtitle: ''
description: ''
keywords: null
author: JIeJaitt
language: zh-CN
timezone: ''
url: https://jiejaitt.github.io
root: /
#permalink: ':year/:month/:day/:title/'
# permalink_defaults: null
permalink: posts/:abbrlink.html
abbrlink:
  alg: crc32  # 算法:crc16(default) and crc32
  rep: hex    # 进制:dec(default) and hex

pretty_urls:
  trailing_index: true
  trailing_html: true
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: ':lang'
skip_render: null
new_post_name: ':title.md'
default_layout: post
titlecase: false
external_link:
  enable: true
  field: 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: ''
index_generator:
  path: ''
  per_page: 10
  order_by: '-date'
default_category: uncategorized
category_map: null
tag_map: null
meta_generator: true
date_format: YYYY-MM-DD
time_format: HH:mm:ss
updated_option: mtime
per_page: 10
pagination_dir: page
include: null
exclude: null
ignore: null
theme: icarus
deploy:
  type: git
  repo: [email protected]:JIeJaitt/jiejaitt.github.io.git
  branch: main

  • 主题配置文件_config.icarus.ymlthemes/icarus/_config.yml
version: 5.1.0
variant: default
logo: /img/logo.svg
head:
    favicon: /img/favicon.svg
    manifest:
        name: 
        short_name: 
        start_url: 
        theme_color: 
        background_color: 
        display: standalone
        icons:
            -
                src: ''
                sizes: ''
                type: 
    open_graph:
        title: 
        type: blog
        url: 
        image: 
        site_name: 
        author: 
        description: 
        twitter_card: 
        twitter_id: 
        twitter_site: 
        google_plus: 
        fb_admins: 
        fb_app_id: 
    structured_data:
        title: 
        description: 
        url: 
        author: 
        publisher: 
        publisher_logo: 
        image: 
    meta:
        - ''
    rss: 
navbar:
    menu:
        Home: /
        Archives: /archives
        Categories: /categories
        Tags: /tags
        About: /about
    links:
        Download on GitHub:
            icon: fab fa-github
            url: https://github.com/JIeJaitt
footer:
    links:
        Creative Commons:
            icon: fab fa-creative-commons
            url: https://creativecommons.org/
        Attribution 4.0 International:
            icon: fab fa-creative-commons-by
            url: https://creativecommons.org/licenses/by/4.0/
        Download on GitHub:
            icon: fab fa-github
            url: https://github.com/JIeJaitt
article:
    highlight:
        theme: atom-one-light
        clipboard: true
        fold: unfolded
    readtime: true
    update_time: true
    licenses:
        Creative Commons:
            icon: fab fa-creative-commons
            url: https://creativecommons.org/
        Attribution:
            icon: fab fa-creative-commons-by
            url: https://creativecommons.org/licenses/by/4.0/
        Noncommercial:
            icon: fab fa-creative-commons-nc
            url: https://creativecommons.org/licenses/by-nc/4.0/
search:
    type: insight
    index_pages: true
comment:
    type: gitalk
    client_id: '62d7216ae38e14428f95'
    client_secret: '4ba230f5f04cfa4bcc4b76a1a10e4da56df38fee'
    repo: 'gitalk'
    owner: 'JIeJaitt'
    admin:
        - JIeJaitt
    per_page: 20                    # 可选填
    distraction_free_mode: false    # 可选填
    pager_direction: last           # 可选填
    create_issue_manually: false    # 可选填
    proxy:                          # 可选填
    flip_move_options:              # 可选填
    enable_hotkey: true             # 可选填
    language: zh-CN                 # 可选填
donates:
    -
        type: afdian
        url: ''
    -
        type: alipay
        qrcode: ''
    -
        type: buymeacoffee
        url: ''
    -
        type: patreon
        url: ''
    -
        type: paypal
        business: ''
        currency_code: USD
    -
        type: wechat
        qrcode: ''
share:
    type: sharethis
    install_url: ''
sidebar:
    left:
        sticky: false
    right:
        sticky: false

widgets:
    -
        position: left
        type: profile
        author: JIeJaitt
        author_title: 有趣的技术实践分享
        location: Your location
        # avatar: https://pic1.imgdb.cn/item/633988e016f2c2beb149e475.jpg
        avatar: /img/avatar.png
        avatar_rounded: true
        gravatar: 
        follow_link: https://github.com/jiejaitt
        social_links:
            Github:
                icon: fab fa-github
                url: https://github.com/jiejaitt
            Facebook:
                icon: fab fa-facebook
                url: https://facebook.com/jiejaitt
            Twitter:
                icon: fab fa-twitter
                url: https://twitter.com/jiejaitt
            Dribbble:
                icon: fab fa-dribbble
                url: https://dribbble.com/jiejaitt
            RSS:
                icon: fas fa-rss
                url: /
    -
        position: right
        type: toc
        index: true
        collapsed: true
        depth: 3
    -
        position: left
        type: links
        links:
            Icarus: https://jiejaitt.github.io
            Notion: https://jiejaitt.notion.site
    -
        position: left
        type: categories
    -
        position: right
        type: recent_posts
    -
        position: left
        type: archives
    -
        position: left
        type: tags
        order_by: name
        amount: 
        show_count: true
    -
        position: left
        type: subscribe_email
        description: 
        feedburner_id: ''
    -
        position: left
        type: adsense
        client_id: ''
        slot_id: ''
    -
        position: left
        type: followit
        description: 
        action_url: ''
        verification_code: ''
plugins:
    animejs: true
    back_to_top: true
    baidu_analytics:
        tracking_id: 
    bing_webmaster:
        tracking_id: 
    busuanzi: false
    cnzz:
        id: 
        web_id: 
    cookie_consent:
        type: info
        theme: edgeless
        static: false
        position: bottom-left
        policyLink: https://www.cookiesandyou.com/
    gallery: true
    google_analytics:
        tracking_id: 
    hotjar:
        site_id: 
    katex: false
    mathjax: false
    outdated_browser: false
    progressbar: true
    statcounter:
        project: 
        security: 
    twitter_conversion_tracking:
        pixel_id: 

providers:
    cdn: jsdelivr
    fontcdn: google
    iconcdn: fontawesome

  • front-matter
---
title: 标题
excerpt: 摘要
toc: true
---

复现方式
命令行使用 hexo g之后就出现了,试过了网上很多方法和报错里面的把locale改成updateLocale 也没什么效果,之前该主题的issue在2019年也提过这个问题,但是好像因为issue不符合规范就被作者直接关闭了,所以我这次提一个更加规范的issue。

期望行为
正常hexo g构建,不会出现该警告或者是报错
截图
image

@ppoffice ppoffice added bug:core Issues about layout, styles, scripts, etc. bug:general Issues with this theme in general. and removed bug:core Issues about layout, styles, scripts, etc. labels Dec 14, 2022
@ppoffice
Copy link
Owner

Related to #1031 #809.

导致此问题的原因为Icarus中的某些组件在设置日期的语言时,语言的名称与moment.js内置的语言名称不一致。例如_config.yml中设置的语言为zh-CN而moment.js内置的语言名为zh-cn。从而moment.js在加载的过程中会重复加载同一个语言文件,引发Deprecation warning。

有趣的是,在大小写敏感的文件系统上(如NTFS与ext4),重复加载并不会导致warning。因为moment.js在大小写敏感的文件系统上加载zh-CN时会找不到语言文件zh-CN.js(因为moment.js只有zh-cn.js)。而macOS的文件系统APFS对文件的大小写不敏感,所以会触发bug。

此问题已在最新版本的Icarus中修复。

@JIeJaitt
Copy link
Author

Related to #1031 #809.

导致此问题的原因为Icarus中的某些组件在设置日期的语言时,语言的名称与moment.js内置的语言名称不一致。例如_config.yml中设置的语言为zh-CN而moment.js内置的语言名为zh-cn。从而moment.js在加载的过程中会重复加载同一个语言文件,引发Deprecation warning。

有趣的是,在大小写敏感的文件系统上(如NTFS与ext4),重复加载并不会导致warning。因为moment.js在大小写敏感的文件系统上加载zh-CN时会找不到语言文件zh-CN.js(因为moment.js只有zh-cn.js)。而macOS的文件系统APFS对文件的大小写不敏感,所以会触发bug。

此问题已在最新版本的Icarus中修复。

感谢解答,我在升级版本之后就没有再出现过该错误了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:general Issues with this theme in general.
Projects
None yet
Development

No branches or pull requests

2 participants