记一次找不到hexo命令

文章目录
  1. 1. 解决

本文最后更新于 <span id="expire-date"></span> 天前,文中部分描述可能已经过时。

zsh: hexo: command not found
bash: hexo: command not found

明明之前已经安装好 hexo, 突然找不到命令。

参考这篇帖子 deepin下hexo莫名就没有了

运行 whereis hexo 找不到对应路径。

重新安装试试:

❯ npm install hexo-cli -g       
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/hexo-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

解决

在文件夹右键 “以管理员身份打开终端”

HP-735G5-Deepin# npm install hexo-cli -g
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
/usr/local/bin/hexo -> /usr/local/lib/node_modules/hexo-cli/bin/hexo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/hexo-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ hexo-cli@4.2.0
added 65 packages from 337 contributors in 73.705s
HP-735G5-Deepin# hexo
zsh: command not found: hexo
HP-735G5-Deepin# whereis hexo
hexo: /usr/local/bin/hexo

终于找到路径了。

运行 micro ~/.zshrc 添加:

export PATH=/usr/local/bin/hexo$PATH

重新开个窗口:

❯ hexo -v                         
INFO Validating config
INFO DPlayer.min.css is not found in this version of dplayer, skip it.
hexo: 5.3.0
hexo-cli: 4.2.0
os: Linux 5.10.5-amd64-desktop+ linux x64
http_parser: 2.9.3
node: 10.21.0
v8: 6.8.275.32-node.56
uv: 1.24.1
zlib: 1.2.11
brotli: 1.0.7
ares: 1.14.0
modules: 64
nghttp2: 1.41.0
napi: 6
openssl: 1.1.1d
icu: 63.1
unicode: 11.0
cldr: 34.0
tz: 2018e

完毕。

本文作者:青菜芋子

本文链接: https://loafing.cn/posts/hexo-command-not-found.html

文章默认采用 CC BY-NC-SA 4.0 许可协议,如有转载请注意遵循。

评论

您所在的地区可能无法访问 Disqus 评论系统,请切换网络环境再尝试。