安装Hexo
Hexo就是我们的个人博客网站的框架, 这里需要自己在电脑常里创建一个文件夹,可以命名为Blog,Hexo框架与以后你自己发布的网页都在这个文件夹中。
创建好后,进入文件夹中,按住shift键,右击鼠标点击命令行
使用npm命令安装Hexo,
输入:npm install -g hexo-cli (参考:https://zhuanlan.zhihu.com/p/26625249)
在这里可能会出现:
npm 安装报错 :(参考:https://blog.csdn.net/qq_31945977/article/details/81537917)
rollbackFailedOptional verb npm-session
此时使用cnpm的获取镜像
1.安装cnpm
(1) 输入以下命令
npm install -g cnpm --registry=https://registry.npm.taobao.org
修改npm的资源镜像链接
npm config set registry http://registry.npm.taobao.org
之后,初始化我们的博客(参考:https://zhuanlan.zhihu.com/p/26625249)
输入:hexo init blog
注意,这里的命令都是作用在刚刚创建的Blog文件夹中。为了检测我们的网站雏形,分别按顺序输入以下三条命令:
hexo new test_my_site
hexo g
hexo s
然后在输入上面三条语句的过程中可能出现下面这种情况
Usage: hexo <command>
Commands:
help Get help on a command. init Create a new Hexo folder. version Display version information.
Global Options:
--config Specify config file instead of using _config.yml --cwd Specify the CWD --debug Display all verbose messages in the terminal --draft Display draft posts --safe Disable all plugins and scripts --silent Hide output on console
For more help, you can use 'hexo help [command]' for the detailed information
or you can check the docs: http://hexo.io/docs/
此时按顺序输入下列语句(参考:https://www.xttblog.com/?p=1807)
1.hexo init C:/hexo
2.cd C:/hexo
3.npm install
然后在执行hexo server命令,即可成功启动服务
hexo server
然后打开浏览器输入localhost:4000
就可以看到下面的界面了