I am trying to install NVM as per these instructions
I typed in this command in terminal:
$ curl https://raw.github.com/creationix/nvm/master/instal
Add the following lines to the files ~/.bashrc
and ~/.bash_profile
:
# NVM changes
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
and restart the terminal or do source ~/.bashrc
or source ~/.bash_profile
. If you need command completion for nvm then also add the line:
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
Along with the above lines to ~/.bashrc
and ~/.bash_profile
.
I had fixed this problem.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
For me this worked.
First check that the file .bashrc
has following line
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
Now bashrc
is loaded for each terminal session. Thus restart the terminal so that it is loaded again and you should be good to go.
For MacOS;
Run on Terminal >
open ~/.bash_profile
Paste all of this=
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
After trying multiple steps, not sure what was the problem in my case but running this helped:
touch ~/.bash_profile
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
Verified by nvm --version
I think you missed this step:
source ~/.nvm/nvm.sh
You can run this command on the bash OR you can put it in the file /.bashrc or ~/.profile or ~/.zshrc to automatically load it
https://github.com/creationix/nvm