Spend a whole night working on updating Hexo. It is much more complicated than I expected. For anyone’s convenience, I record some key points when migrate from Hexo 2.x to 3.0 besides the official documentation.
First things first: uninstall Hexo
Yes. Though the official wiki says that we can directly migrate from 2.x to 3.0, this doesn’t work (to me). Besides, instead of wasting time figuring out what’s wrong when updating, re-installating and configurating Hexo 3.0 seems acceptable to me. You can try to update directly but I didn’t do that successfully.
Before your uninstallation, backup your posts and any other custom setting files (eg. _config.yml
, your own theme file, etc).
To uninstall Hexo, use the node package manager(npm):
1 | npm uninstall hexo |
Now, install Hexo 3.0
Run
1 | $ sudo npm install -g hexo-cli |
Hexo wiki doesn’t mention the administration permission, but in my experience we have to add sudo
here.
Then we need to setup hexo folder in your desired place(folder).
1 | $ hexo init <folder> |
Still, try sudo
when you fail to run any command.
For your future convenience, we install all necessary services here:
1 | npm install hexo-generator-index --save |
and any plugins you probably need:
1 | npm install hexo-renderer-marked@0.2 --save |
All in sudo mode (or you can directly do all of these in sudo -i
mode).
Now, we finished installation.