Upgrading Hexo

I’m using Hexo as my blogging platform (static content generator). Every time I upgrade it I run into some kind of issue. Usually because:

  • I upgrade rarely and I have made some changes into themes etc.
  • I don’t remember how to upgrade hexo and plugins to the latest version with NPM. It seems that one command doesn’t work. Some parts upgrade and some don’t.
  • I forget to delete some temporary files and first time running hexo generate produces invalid results

I decided to document the steps so that I don’t have to google them every time. These steps assume you are using Git to keep your blog content and you are deploying the generated content. If not just ignore everything that talks about branches.

Correct branch

Typically, source branch is where the source of the blog is (markdown files etc.) and master is for generated content. Make sure you are in the source branch.


Before upgrading remove all the files/folders that will be recreated either during npm install or when generating content.

  1. Delete .deploy_git folder
  2. Delete node_modules folder
  3. Delete db.json
  4. Delete public folder

Modify package.json

The package.json should only contain the following:

"hexo": {
"version": ""

Install latest version of hexo-cli

npm install hexo-cli -g

Install Hexo

You should run this in the folder where hexo is installed.

npm install hexo --save

Install plugins

Install the plugins you use.

npm install hexo-server --save
npm install hexo-renderer-ejs --save
npm install hexo-renderer-marked --save
npm install hexo-renderer-stylus --save
npm install hexo-generator-index --save
npm install hexo-generator-feed --save
npm install hexo-generator-sitemap --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-deployer-git --save


Generate the content

hexo generate

Start the server

hexo server

After these steps you should have the latest version of hexo and plugins running.