Install NodeJS and Yarn on Raspberry Pi

Install NodeJS and Yarn on Raspberry Pi
Photo by Önder Örtel / Unsplash

Install NodeJS

apt update
apt upgrade
apt-get install ca-certificates curl gnupg -y

curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg

NODE_MAJOR=18

echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

apt update
apt install nodejs -y

Check NodeJS instalation

node -v

Install Yarn

npm install yarn -g