On my dev server (CentOS), I installed
nvm (Node Version Manager) and use that to install various node versions.
nvm is installed for the root user only.
I noticed that after I restart the server, for
# node -v gives me
bash: node: command not found
Of course I can simply say
# nvm use v0.12.5 but then after another reboot, it doesn't stay. I have to re-specify it again.
Is this normal? Why is this? Is there a way to specify a default so I don't have to do this each time a reboot happens?
Best How To :
There's an oft-overlooked paragraph at the top of the Usage section of the README (relevant emphasis mine):
You can create an
.nvmrc file containing version number in the project root directory (or any parent directory).
nvm run, and
nvm which will all respect an
.nvmrc file when a version is not supplied.
Using this method, you should be able to create a
.nvmrc file in the home directory for
root that would set the desired
node version on at least interactive shells. Note that attempting to use
nvm from non-interactive shells would be tricky, as it requires you to source
Additionally, you can register an alias named
default for a specific version with
nvm alias default <version>.