運行hexo命令時,發現如題這個錯誤。hexo是在之前安裝好的。
發現原來是沒有指定nodejs所致。
可以使用下面命令解決:
xsqMacBook-Pro:~ xsq$ hexo
-bash: hexo: command not found
xsqMacBook-Pro:~ xsq$ hexo server
-bash: hexo: command not found
xsqMacBook-Pro:~ xsq$ nvm ls
v5.0.0
node -> stable (-> v5.0.0) (default)
stable -> 5.0 (-> v5.0.0) (default)
iojs -> N/A (default)
xsqMacBook-Pro:~ xsq$ nvm use v5.0.0
Now using node v5.0.0 (npm v3.3.6)
xsqMacBook-Pro:~ xsq$ nvm alias default v5.0.0
default -> v5.0.0
xsqMacBook-Pro:~ xsq$ hexo
Usage: hexo <command>
Commands:
help Get help on Hexo.
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
--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/
xsqMacBook-Pro:~ xsq$
如果是mac用戶全局安裝hexo的時候記得使用sudo,使用管理員權限,否則會報沒有權限
sudo npm install-g hexo
如果還是不行,重啟終端。
查看是否安裝成功
node -v