美文网首页
zsh: command not found: xxxx

zsh: command not found: xxxx

作者: YjjTT | 来源:发表于2018-12-07 10:41 被阅读0次

记录一下

今天使用Hexo+ GitHub搞个博客,在使用npm全局安装hexo的时候出现了这个问题,zsh:command not found: hexo

npm install -g hexo
hexo init myBlog

解决

两种方法

  1. reinstall npm with a version manager 重新安装npm
  2. change npm's default directory manually 修改npm默认所在文件夹
    ,也就是npm全局安装包所在的文件夹

第二种方法操作:

  • 新建一个文件夹 mkdir ~/.npm-global
  • 配置 npm config set prefix '~/.npm-global'
  • 写入PATH export PATH=~/.npm-global/bin:$PATH
  • 保存 source ~/.profile
  • 接下来在重新安装就可以了 done!

其实上面2-4步, 也可以简化成一步 NPM_CONFIG_PREFIX=~/.npm-global

追加, 如果重启了iterm又不行了

vi ~/.zshrc 进入编辑在最后面加上source ~/.bash_profile

相关文章

网友评论

      本文标题:zsh: command not found: xxxx

      本文链接:https://www.haomeiwen.com/subject/gunzcqtx.html