run last version of nvm script in [https://github.com/creationix/nvm#install-script]:
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
$ nvm install node
you must see something like:
Downloading https://nodejs.org/dist/v8.7.0/node-v8.7.0-linux-armv7l.tar.gz... ######################################################################## 100,0% Computing checksum with sha256sum Checksums matched! Now using node v8.7.0 (npm v5.4.2) Creating default alias: default -> node (-> v8.7.0)
run this last 3 lines of .bashrc in this same shell or close shell and open a new one:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Done!
List installed node versions
$ nvm ls
Current node:
$ nvm current
run node alias (latest version) through nvm shell function:
$ nvm run node --version
run arbitrary command in a subshell with a speficic node version (8.7) through nvm:
$ nvm exec 8.7 node --version
query install path for a conrete node version:
$ nvm which 8.7
install another version of node:
$ nvm install 6.0
To just use node and forget nvm:
$ nvm use node
Now using node v8.7.0 (npm v5.4.2)
$ node --version
v8.7.0