Homebrew installs nvm but nvm can't be found afterwards?

前端 未结 10 1335
既然无缘
既然无缘 2020-12-22 20:53

I\'m using homebrew and oh-my-zsh on a fresh OSX 10.10.1 install. I got nvm via homebrew and then attempted to run it but

10条回答
  •  一个人的身影
    2020-12-22 21:24

    The reason you would need to reload your bash profiles or any other bash files might be because the command nvm may not be a program but a function that is defined and can only be used if the corresponding bash file is sourced.

    On a system that I checked

    which nvm 
    

    does not work but

    nvm list
    

    does. This means that you can use the word "nvm" to invoke something. That something isn't a program. In the current case, it is a function which can be verified by

    typeset -F | grep -P ' nvm$'
    

    which outputs

    declare -F nvm
    

    which means nvm is a function, whose body can be inspected by doing

    type -F nvm
    

提交回复
热议问题