In the system there is a nodejs
, installed through nvm
. The command is not running npm
. Console is Oh my zsh
nvm comes with a default bash_completion profile. If you want to enable it, you can do it by exporting the NVM_COMPLETION environment variable and setting it to true . It must be set before zsh-nvm is loaded.
Node Version Manager, more commonly called nvm, is the most popular way to install multiple versions of Node. js, but is only available for Mac/Linux and not supported on Windows. Instead, we recommend installing nvm-windows and then using it to install Node. js and Node Package Manager (npm).
You can use zsh-nvm or enable it yourself by adding following lines to your ~/.zshrc
export NVM_DIR=~/.nvm [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
Extra:
For faster shell initialization, I use lazynvm
which only loads node when needed
lazynvm() { unset -f nvm node npm export NVM_DIR=~/.nvm [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm } nvm() { lazynvm nvm $@ } node() { lazynvm node $@ } npm() { lazynvm npm $@ }
Reference: Lazy load nvm for faster shell start
Switching from Bash to Oh-My-Zsh
If you already have nvm
installed and you're switching from bash
to oh-my-zsh
you can simply open up your .zshrc
file and add the nvm
plugin that is included with oh-my-zsh
:
.zshrc
in nano with this command: nano ~/.zshrc
plugins=(git)
and add nvm
inside the parentheses to make it show as plugins=(git nvm)
(separate plugins with spaces)control
+ O
(on macOS), then enter
, to save, then press control
+ X
to exitnvm ls
to confirm it works. Note that you must open a new window/tab for your shell to use the newly updated .zshrc
config (or enter source ~/.zshrc
, etc.)Source: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/nvm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With