hexo upgrade

hexo

what is hexo

“Hexo is a fast, simple and powerful blog framework. You write posts in Markdown (or other markup languages) and Hexo generates static files with a beautiful theme in seconds.”

how to use hexo

Hexo is dependent on Git and Node.js. After installed the two, if you are lucky, you can start to use Hexo as the official documentation(https://hexo.io/docs/) does. Here I will focus on the problems I have met. I accidently uninstalled Node.js and installed newest Node.js on my laptop, however, this action caused a series of problems. I spent 3 hours to fix the problem. In this opportunity, I will document the encountered issues and their solutions. At the same time, I will clarify the dependencies among these software tools.

problems

Here we assume that we have installed Git and Node.js successfully. We can check this by running

1
git --version

1
node -v

The first issue I encountered was when I ran

1
hexo deploy

I got “TypeError [ERR_INVALID_ARG_TYPE]: The “mode” argument must be integer”.

As https://github.com/hexojs/hexo/issues/4281 suggests, I upgraded Hexo, but it didn’t work, and there was another problem, I ran

1
2
npm install -g hexo-cli
npm install -g hexo

Hexo is still older version. After I modified package.json under the Hexo path and using command like this, it upgraded.
1
npm i hexo@5.2.0

Unfortunately, even I upgraded Hexo to the newest version, I still got the error, so I decided to degraded Node.js. This is where I knew about nvm, a command-line tool that allows you to easily manage multiple versions of Node.js on a single machine. With nvm, you can install, switch between, and manage different Node.js versions for your development projects. Remember to uninstall the Node.js first, I didn’t, so when I use nvm to install an older version, I still got the installed version.
Finally got the older version, I got “YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.”, then as https://github.com/hexojs/hexo/issues/4917 suggests, I degraded Node.js and installed yaml-js.

Running hexo again, I got “TypeError: Cannot read property ‘length’ of undefined” and “Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./lib/js-yaml/type’ is not defined by “exports””, then I upgraded the theme I use and ran npm install to fix the problem, but there are still some problems with the theme. I reinstalled the theme as https://github.com/ppoffice/hexo-theme-icarus. As the theme upgrading, there are more dependencies needed, just install them as the message shows.

reference

https://hexo.io/docs/
https://github.com/ppoffice/hexo-theme-icarus

Markdown

第一篇 Markdown (Typora)

基础语法

目录

标题篇

级数个#加空格,如# 表示后面的文字作为一级标题,## 表示后面的文字作为二级标题。

字体篇

加粗:将想要加粗的文字在左右用两个*号括起来 :

**加粗**

斜体:将想要斜体的文字在左右用一个*号括起来 :

斜体加粗:将想要斜体的文字在左右用三个*号括起来

删除线:将想要加删除线的文字在左右用两个~号括起来波浪线

段落篇

  • 生成目录:[toc], 但是hexo上传博客用此方法显示目录不成功ORZ。

  • 分割线:三个及以上的-或者*,试一试


  • 无序列表:就是这个前面的小黑点,一个+-或者*加上空格,后面跟上文字。

  • 有序列表:数字标号的。数字加点加上空格

    1. 这是第一个
    2. 这是第二个


插入类

  • 插入图片:![图片下方的文字](图片地址 "图片标题")

拿一张试试:试验图片

  • 插入超链接:[超链接名称](超链接地址 "标题")

    试试:我的博客

  • 插入公式:$$包含TeX 或 LaTeX 格式的数学公式。

  • 插入表格:|分列,-分割表头和内容,左右两边加:文字居中,只加一边文字偏哪边,默认偏左。

    举例

    1
    2
    3
    4
    表头|表头
    --|--
    内容|内容
    内容|内容

    试一个:没有成功诶,需要在两端也加上|才会显示表格,可是把最后一行作为表头显示了,emmm,应该是编辑器导致的差异。不过Typora可以很方便地直接右击插入表格。。。

表头 表头
内容 内容
内容 内容
  • 插入代码块

    单行代码:一个反引号`括起来,反引号就是Esc下面那个键,记得换成英文输入法。

    print('hello world!')

    多行代码:三个反引号`括起来。

    1
    2
    import numpy as np
    import pandas as pd

My first blog

This is my first blog which is just for test. Happy~
I will present my learning process in this blog from today on. Fighting~

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment