最近给点击安装了 oh-my-zsh,但是安装之后在命令行输入 node 显示 zsh: command not found: node
,这时候粗略判断应该是系统变量出了问题。oh-my-zsh 的变量文件是 ~/.zshrc
,我们编辑这个文件,在文件末尾添加如下内容即可:
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
这个时候再运行
source ~/.zshrc
这样系统变量就生效了。