在 Linux 环境上安装完 Hexo 之后,发现报如下错,找不到hexo命令:

1
2
[root@xxx ~]# hexo version
-bash: hexo: command not found

解决方案:

找到对应安装的位置

1
2
3
4
5
6
7
8
9
[root@xxx ~]# find / -name hexo 
/usr/local/nodejs/lib/node_modules/hexo-cli/bin/hexo
/usr/local/nodejs/bin/hexo
/var/lib/jenkins/workspace/blog/node_modules/.bin/hexo
/var/lib/jenkins/workspace/blog/node_modules/hexo
/var/lib/jenkins/workspace/blog/node_modules/hexo/lib/hexo
/var/lib/jenkins/workspace/blog/node_modules/hexo/node_modules/.bin/hexo
/var/lib/jenkins/workspace/blog/node_modules/hexo/node_modules/hexo-cli/bin/hexo
/var/lib/jenkins/workspace/blog/node_modules/hexo/bin/hexo

添加环境变量

1
[root@xxx bin]# ln -s /usr/local/nodejs/lib/node_modules/hexo-cli/bin/hexo /usr/local/bin/hexo