Skip to content

Install Node.js

Volodymyr Huz edited this page Dec 7, 2021 · 3 revisions

Install and configure Node.js for using HomeBridge.

Patch and update your Pi

sudo apt-get update
sudo apt-get dist-upgrade

First way to install

Include NodeSource repository into sources list

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

Install Node.js

sudo apt-get install -y nodejs

Check Node.js version

node --version

Second way to install

Download end execute bash script to install nvm (Node Version Manager)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Close and reopen your terminal to start using nvm

Check nvm version

nvm --version

Install Node.js latest version

nvm install node

Check Node.js version

node --version

Install additional specific node version (8.9.4)

nvm install 8.9.4

List installed node versions

nvm ls

Change the active node version

nvm use 8.9.4

Check current node version that is using

nvm current

Add Node JS into path variables

export PATH=$PATH:/home/osmc/.nvm/versions/node/v13.9.0/bin

Remove Node.js

sudo apt-get remove nodejs

Clone this wiki locally