how to install node.js code example

Example 1: linux install node

sudo apt install nodejs

Example 2: linux install node

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

Example 3: install node js command

# Make a new folder for node
mkdir node
cd node
# Download and unzip node
curl -O https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.gz
tar -xvzf node-v10.15.3-linux-x64.tar.gz --strip-components=1
# Add node and npm it to PATH (and do so for future sessions too)
export PATH=$HOME/node/bin:$PATH
echo 'export PATH=$HOME/node/bin:$PATH' >> ~/.bashrc

Example 4: install noedjs

brew install node

Example 5: nodejs install

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end('Hello World!');
}).listen(8080);

Example 6: npm

official => https://www.npmjs.com/