3

新手上路

指令

创建文章

$ hexo new "My New Post"

启动本地 Server

// 默认监听4000端口
$ hexo server

//or

$ hexo s

命令运行成功后可通过 http://localhost:4000/ 访问页面。

使用 -p 后缀可指定监听端口号,默认监听4000端口。

// 监听3000端口
$ hexo s -p 3000

生成静态文件

$ hexo generate

// or

$ hexo g

部署

$ hexo deploy

// or

$ hexo d

在部署之前,要先执行生成静态文件,否则部署时无法检测到文件更新。

FAQ

运行hexo命令总提示 Module version mismatch. 异常

[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:

  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


ChanceWong
1.4k 声望49 粉丝

More than front-end :p


引用和评论

0 条评论