Reputation: 13
$ nvm ls:
.nvm
v0.11.12
v0.11.13
I have to keep hitting nvm use v.0.11.13 in every session:
.nvm
v0.11.12
-> v0.11.13 I've tried both the brew install, as well as the official installation script.
Upvotes: 1
Views: 4830
Reputation: 516
Try putting a .nvmrc
file at the root of your project. It shall contain:
v0.11.13
Then, you could add this little snippet at the end of your ~/.bashrc
(or whatever bash you're using):
# Use node version (nvm use)
autoload -U add-zsh-hook
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
elif [[ $(nvm version) != $(nvm version default) ]]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
This should properly set the node
version as soon as you enter a directory containing a proper .nvmrc
file.
Upvotes: 2
Reputation: 1445
use this in the terminal.
$ nvm alias default v0.11.13
for more help go to https://github.com/creationix/nvm or write nvm help
in terminal.
Upvotes: 5