Install NodeJS on Armbian

What is NodeJS

Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser. -https://github.com/nodejs/node

Installing NodeJS

  1. Log into the Armbian device
  2. Run the following commands in a terminal window
    # download nodejs
    wget -O nodejs.tar.xz https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz
    # extract nodejs.tar.xz
    tar -xJf nodejs.tar.xz
    # change directory to extracted folder
    cd node-v14.17.0-linux-arm64
    # copy node binaries to /usr/local
    sudo cp -R * /usr/local/
    # test node is working
    node -v
    # test npm is working
    npm -v

Running a Test NodeJS Application

  1. Run the following commands in a terminal window
    # install git
    sudo apt install git -y
    # make a working diretory
    mkdir ~/njs-demo && cd ~/njs-demo
    # clone demo github repo
    git clone https://github.com/benc-uk/nodejs-demoapp.git
    # cd into src directory
    cd nodejs-demoapp/src
    # install dependencies
    npm install
    # run the demo app
    node server.js
  2. Open a web browser and navigate to http://DNSorIP:3000