Hexo 建站之旅

新手上路

指令

建立文章node

$ hexo new "My New Post"

啓動本地 Servergit

// 默認監聽4000端口
$ hexo server

//or

$ hexo s

命令運行成功後可經過 http://localhost:4000/ 訪問頁面。github

使用 -p 後綴可指定監聽端口號,默認監聽4000端口。npm

// 監聽3000端口
$ hexo s -p 3000

生成靜態文件hexo

$ hexo generate

// or

$ hexo g

部署ide

$ hexo deploy

// or

$ hexo d

在部署以前,要先執行生成靜態文件,不然部署時沒法檢測到文件更新。ui

FAQ

運行hexo命令總提示 Module version mismatch. 異常code

[Error: Module version mismatch. Expected 47, got 44.]
{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }

It seems there was a mismatch between one of:server

  1. The hexo in node_modules/.bin部署

  2. The hexo in /usr/local/bin/hexo

The globally installed hexo which may well have been the one from 2.

My solution was:

npm uninstall -g hexo-cli
rm /usr/local/bin/hexo
rm -rf node_modules
npm install
npm install -g hexo-cli

Detail see Module version mismatch #1742

相關文章
相關標籤/搜索