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
- Log into the Armbian device
- 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
- 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 - Open a web browser and navigate to http://DNSorIP:3000