Skip to content

Instantly share code, notes, and snippets.

@Peregrinox
Last active February 5, 2018 13:26
Show Gist options
  • Save Peregrinox/548f17323bb320d701d91401b926d967 to your computer and use it in GitHub Desktop.
Save Peregrinox/548f17323bb320d701d91401b926d967 to your computer and use it in GitHub Desktop.
node on osmc through nvm

Install nvm:

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

Install latest node with nvm

$ 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!

To use nvm and some concrete node version through nvm:

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment