找不到hexo指令 #
当执行hexo命令时遇到如下error
lbz@DESKTOP-DE7NKM0 MINGW64 /d/wd/Temp/hexo (hexo-backup)
$ hexo s
ERROR Cannot find module 'hexo' from 'D:\wd\Temp\hexo'
ERROR Local hexo loading failed in D:\wd\Temp\hexo
ERROR Try running: 'rm -rf node_modules && npm install --force'
产生原因 #
这个错误的原因是缺少node_modules文件夹,因此无法生成文件。
hexo init失败 #
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': OpenSSL SSL_read: Connection was reset, errno 10054
WARN git clone failed. Copying data instead
FATAL {
err: [Error: ENOENT: no such file or directory, scandir 'C:\Users\lbz\AppData\Roaming\npm\node_modules\hexo-cli\assets'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Users\\lbz\\AppData\\Roaming\\npm\\node_modules\\hexo-cli\\assets'
}
} Something's wrong. Maybe you can find the solution here: %s http://hexo.io/docs/troubleshooting.html
解决方法 #
由上面错误可以看出是git clone出现问题,所以给git设置代理解决。由于我这边使用的是v2ray代理,所以http/https代理可设置如下:
git config --global https.proxy 'vmess://127.0.0.1:7890' #vmess为协议类型 #7890为代理端口号
git config --global http.proxy 'vmess://127.0.0.1:7890'