source ~/.profileAlternatively, run the command suggested in the output of the script. Now type:
nvm ls-remoteShould you see the error,
-bash: nvm: command not found
it may be because git is not installed.apt-get install gitAnd you will be shown a list of all the available versions of node.js. You can always find out the latest stable release by heading to the node.js website, where it's printed in the center of the page. To install version 0.10.13 (the latest as of this writing) type:
nvm install 0.10.13If you type:
node --versionYou will now see that node v0.10.13 is installed and active. If you had an older node app that only works with node v0.8.16, and wanted to downgrade, then you would input:
nvm install v0.8.16to install and switch to v0.8.16.
nvm use v0.10.13Nvm is great and makes switching between node versions easy and convenient. However, there's one caveat. If you type:
which nodeyou will see something interesting. Nvm installs node.js inside your user's home directory. This is fine for development, but if you want to actually host node applications, you don't want to install the latest new version of node via nvm and discover that you've inadvertently caused your production node app (which can be incompatible with the latest node.js) to stop working. It's best to install one copy of node globally so that other users can access it, and use nvm to switch between your development versions. To do this, run the following command (entering your user's password at the prompt):
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/localThe above command is a bit complicated, but all it's doing is copying whatever version of node you have active via nvm into the /usr/local/ directory (where user installed global files should live on a linux server ) and setting the permissions so that all users can access them.
If you ever want to change the version of node that's installed system wide, just do another nvm use vXX.XX.XX to switch your user's node to the version you want, and then re-run the above command to copy it to the system directory.To check that it works, become the root user and do another which command to make sure that node is now installed to /usr/local/bin:
sudo -s which nodeYou should see:
/usr/local/bin/nodeCongrats! Node.js is now installed and ready for use. Enjoy!
Article ID: 226
Created On: Sun, Dec 29, 2013 at 11:05 PM
Last Updated On: Sun, Jan 5, 2014 at 8:48 PM
Authored by: ASPHostServer Administrator [asphostserver@gmail.com]
Online URL: http://faq.asphosthelpdesk.com/article.php?id=226