avatar

目录
Hexo之踩坑

背景环境:本着在家有时间将github上由hexo创建的blog克隆到本地,但由于本机首次配置,一路踩了不少坑~

问题一

javascript
1
bash: hexo: command not found

本着能解决问题就不重装的原则,首先检查 nodejs 和 npm 是否正常,依次输入命令 node -v 和 npm -v 看看是否有相关版本信息

出现了版本信息就证明 nodejs 和 npm 是没有问题的,那么就应该是环境变量的配置问题了,在【此电脑】右键【属性】,依次选择【高级系统设置】-【环境变量】,选择系统变量 Path,将 node_modules 下的 .bin 文件路径添加到 Path 里面

我本地blog的项目下的系统变量为:D:\workspace\hexo_blog\Blog_hexo\node_modules.bin

环境变量添加好了之后重新打开 git 即可运行 hexo 命令,如果此时仍然无法执行 hexo 命令,那就只能拿出终极绝招了,运行命令 npm install hexo-cli -g 重新安装 hexo 即可!

hexo -version //查看hexo安装版本
之后本项目的配置ok,大兄弟们可以继续在该项目开发了…

问题二

Hexo初始化的时候,提示如下错误?

javascript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 $ hexo init
FATAL D:\workspace\hexo_blog\Blog_hexo\ not empty, please run `hexo init` on an empty folder and then copy your files into it
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: target not empty
at Hexo.initConsole (D:\workspace\hexo_blog\Blog_hexo\node_modules\hexo\node_modules\hexo-cli\lib\console\init.js:23:27)
at Hexo.tryCatcher (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\util.js:16:23)
at Hexo. (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\method.js:15:34)
at D:\workspace\hexo_blog\Blog_hexo\node_modules\hexo\lib\hexo\index.js:248:17
at Promise._execute (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\debuggability.js:384:9)
at Promise._resolveFromExecutor (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\promise.js:518:18)
at new Promise (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\promise.js:103:10)
at Hexo.call (D:\workspace\hexo_blog\Blog_hexo\node_modules\hexo\lib\hexo\index.js:244:12)
at D:\workspace\hexo_blog\Blog_hexo\node_modules\hexo\node_modules\hexo-cli\lib\hexo.js:67:17
at tryCatcher (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (D:\workspace\hexo_blog\Blog_hexo\node_modules\bluebird\js\release\async.js:86:9)

解决方案:Hexo 初始化只能找一个空目录初始化

文章作者: 会吃鱼的猫
文章链接: https://lovecatdog.github.io/2020/04/13/Hexo%E4%B9%8B%E8%B8%A9%E5%9D%91/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 LoveCatDog
打赏
  • 微信
    微信
  • 支付宝
    支付宝

评论
简体中文