frhd frhd - 2 years ago 127
Node.js Question

nvm keeps "forgetting" node in new terminal session

Upon using a new terminal session in OS X,
forgets the node version and defaults to nothing:

$ nvm ls


I have to keep hitting
nvm use v.0.11.13
in every session:

-> v0.11.13

I've tried both the
install, as well as the official installation script.

for the brew version:

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/

And for the script:

$ curl | bash

export NVM_DIR="/Users/farhad/.nvm"
[ -s "$NVM_DIR/" ] && . "$NVM_DIR/" # This loads nvm

Any clue to what I'm doing wrong?

Answer Source

Try nvm alias default. For example:

$ nvm alias default 0.12.7

This sets the default node version in your shell. Then verify that the change persists by closing the shell window, opening a new one, then: node --version

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download