Documentation

Welcome to the Hexo documentation. If you encounter any problems when using Hexo, have a look at the troubleshooting guide, raise an issue on GitHub or start a topic on the Google Group.

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.

Installation

It only takes a few minutes to set up Hexo. If you encounter a problem and can’t find the solution here, please submit a GitHub issue and we’ll help.

Requirements

Installing Hexo is quite easy and only requires the following beforehand:

  • Node.js (Should be at least Node.js 10.13, recommends 12.0 or higher)
  • Git

If your computer already has these, congratulations! You can skip to the Hexo installation step.

If not, please follow the following instructions to install all the requirements.

Install Git

  • Windows: Download & install git.
  • Mac: Install it with Homebrew, MacPorts or installer.
  • Linux (Ubuntu, Debian): sudo apt-get install git-core
  • Linux (Fedora, Red Hat, CentOS): sudo yum install git-core
For Mac users

You may encounter some problems when compiling. Please install Xcode from App Store first. After Xcode is installed, open Xcode and go to Preferences -> Download -> Command Line Tools -> Install to install command line tools.

Install Node.js

Node.js provides official installer for most platforms.

Alternative installation methods:

  • Windows: Install it with nvs (recommended) or nvm.
  • Mac: Install it with Homebrew or MacPorts.
  • Linux (DEB/RPM-based): Install it with NodeSource.
  • Others: Install it through respective package manager. Refer to the guide provided by Node.js.

nvs is also recommended for Mac and Linux to avoid possible permission issue.

Windows

If you use the official installer, make sure Add to PATH is checked (it’s checked by default).

Mac / Linux

If you encounter EACCES permission error when trying to install Hexo, please follow the workaround provided by npmjs; overriding with root/sudo is highly discouraged.

Linux

If you installed Node.js using Snap, you may need to manually run npm install in the target folder when initializing a blog.

Install Hexo

Once all the requirements are installed, you can install Hexo with npm:

$ npm install -g hexo-cli

Advanced installation and usage

Advanced users may prefer to install and use hexo package instead.

$ npm install hexo

Once installed, you can run Hexo in two ways:

  1. npx hexo <command>
  2. Linux users can set relative path of node_modules/ folder:
echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile

then run Hexo using hexo <command>

Required Node.js version

If you are stuck with older Node.js, you can consider installing a past version of Hexo.

Please note we do not provide bugfixes to past versions of Hexo.

We highly recommend to always install the latest version of Hexo and the recommended version of Node.js, whenever possible.

Hexo version Minimum (Node.js version) Less than (Node.js version)
7.0+ 14.0.0 latest
6.2+ 12.13.0 latest
6.0+ 12.13.0 18.5.0
5.0+ 10.13.0 12.0.0
4.1 - 4.2 8.10 10.0.0
4.0 8.6 8.10.0
3.3 - 3.9 6.9 8.0.0
3.2 - 3.3 0.12 unknown
3.0 - 3.1 0.10 or iojs unknown
0.0.1 - 2.8 0.10 unknown