[NFR] Add Node JS using NVM
joglomedia opened this issue · comments
Installed nvm in /opt/nvm as root. Seemed like an appropriate location.
# git clone https://github.com/nvm-sh/nvm.git /opt/nvm
Created the directory /usr/local/nvm. This is where the downloads will go ($NVM_DIR)
# mkdir /usr/local/nvm
Create the directory /usr/local/node. This is where the NPM global stuff will go:
# mkdir /usr/local/node
Created a file called nvm.sh in /etc/profile.d with the following contents:
# NVM load
export NVM_DIR=/usr/local/nvm # NVM & Node data
export NVM_INSTALL_DIR=/opt/nvm
[ -s "$NVM_INSTALL_DIR/nvm.sh" ] && \. "$NVM_INSTALL_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_INSTALL_DIR/bash_completion" ] && \. "$NVM_INSTALL_DIR/bash_completion" # This loads nvm bash_completion
Append those content also to .bashrc
Re-login to a shell session, then set the default node version.
# nvm install 0.10
# nvm alias default 0.10
The node binaries should now be in the PATH for all users the next time you login to a shell session. NPM will install global things to the /usr/local/node prefix.
Reference: https://stackoverflow.com/a/19040346