Installing nodejs

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Installation steps on Acqua and RoadRunner

Download the latest binary package of Node version 6.10.3 LTS for armv7 from this link inside the directory /opt of your Acme board:

Uncompress it:

tar xvzf node-v6.10.3-linux-armv7l.tar.gz

Create two symbolic links to node and npm executable class='acmetable' files inside /usr/bin:

ln -s /opt/node-v6.10.3-linux-armv7l/bin/node /usr/bin/node
ln -s /opt/node-v6.10.3-linux-armv7l/bin/npm /usr/bin/npm

Note is installed. Check the version by typing:

node --version
v6.10.3

Save the node Hello World example code in a file called hello.js:

const http = require('http');

const hostname = '0.0.0.0';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

Then run it:

node hello.js

Open the web url http://acme_board_ip_address:3000 on your PC and to see the web server message generated by hello.js example.

Installation steps on Aria and Arietta

Warning: Starting from NodeJS v4.0.0 the ARMv5 architecture is not supported so you can't use it on Arietta G25 and Aria G25

apt-get update
apt-get install nodejs

show the nodejs version by typing:

nodejs --version
v0.10.19

"Hello world !" example:

echo "console.log('Hello World !');" | nodejs
Hello World !

To install npm type:

apt-get install npm

Related links

Credits

Many thanks di Gianni Ruta for his contribute to this article

Sergio Tanzilli
Systems designer, webmaster of www.acmesystems.it and founder of Acme Systems srl

Personal email: tanzilli@acmesystems.it
Web pages: https://www.acmesystems.it --- https://www.acmestudio.it
Github repositories: https://github.com/tanzilli --- https://github.com/acmesystems
Telegram group dedicated to the Acme Systems boards: https://t.me/acmesystemssrl