How to make nvm auto-retrieved on login
I am using nvm for node version control.
I like to do nvm for login, so I don't have to do it manually every time I login.
there is a .bashrc file in my user home directory. I added the following two lines to the end of the file. then restart my mac os. after login, nvm is not the source. I have to manually start them again. I don't understand what happened. please, help.
. ~/nvm/nvm.sh
nvm use 0.8.20
source to share
.nvmrc
File usage
It turns out that it is enough to create a file .nvmrc
in your home directory. It loads automatically when you open a terminal.
To create a file .nvmrc
with the version we want to run (0.12.2), do the following:
echo '0.12.2' > ~/.nvmrc
If this does not work for some reason, dial nvm
from your.bashrc
But only if you are working online.
Add a command to run nvm use 0.12.2
(or whatever version you want to run) if the shell runs interactively to the end .bashrc
.
echo '[[ $- == *i* ]] && nvm use 0.12.2' >> ~/.bashrc
Boom, done! :)
source to share