How Do You Install the Angular CLI on a Linux Server?

Problem scenario
You want to test out the Angular CLI on a Linux server. What should you do?

Solution

Prerequisite
Install node and npm. If you nsee assistance, see this posting How Do You Install node and npm on Any Distribution of Linux Server?.

Procedure
Run this command: sudo npm install -g @angular/cli

 » Read more..

How Do You Troubleshoot the ng Error “—–Mg: scratch (fundamental)—-All——————“?

Problem scenario
You run this command ng –version but you receive a blank screen at the terminal like this:

—–Mg: scratch (fundamental)—-All——————

What do you do?

Solution

1. Use “ctrl-z” to exit out.

2. Run these commands:

sudo apt remove ng-common
sudo npm uninstall -g @angular/cli
sudo npm install -g @angular/cli

3.

 » Read more..

How Do You Write a Hello World Program in Node.js?

Problem scenario
You want to write a “Hello World” program using Node.js.  What do you do?

Solution
Prerequisite
Identify the external IP address of the server (e.g., run “curl icanhazip.com” if you have access to the internet).

Procedures
1.  Install node and npm on a Linux server.  If you need assistance with this,

 » Read more..

How Do You Create a Node.js Application to Be Presentable and Usable via a Docker Container?

Problem scenario
You want to create a basic “Hello World” web page with Node.js running in a Docker container.  How do you do this?

Solution
Prerequisite

Install Docker.  If you need assistance, see this posting.

Procedures
1.  Create three files in the same directory on a Linux server.  A possible location would be the home directory of the user that will run the “docker” commands.

 » Read more..

How Do You Write Tic-Tac-Toe in JavaScript?

Problem scenario
You want to write a program using JavaScript. You want to play Tic-Tac-Toe. What do you do?

Solution

1. Save the file below as contint.html to your computer.
2. Open a web browser, preferably Firefox.
3. View the HTML file on your computer via the web browser. (e.g., c:\path\to\contint.html)

<!DOCTYPE html<html<body<h2Play Tic-Tac-Toe with Anyone You Can Share a Keyboard With</h2<p</p<p***************************************************************</p<pTo make your mark,  » Read more..

How Do You Use Azure Functions?

Problem scenario
You want a REST API program to write to logs in a serverless way.  You want to have a program (or some very basic lines of code to) execute upon certain events happening (e.g., to write intelligent pre-processed logs and potentially gather data from multiple sources).  You want to use an Azure PaaS for this.  How do you use Azure functions?

Solution
1.  Log into Azure.

 » Read more..

How Do You Install and Configure Grunt?

Problem scenario
You want to use Grunt the automation tool (https://gruntjs.com).  How do you install it and get it to work on Linux?

Solution
#1  If you are using CentOS, Red Hat Enterprise Linux, or Fedora, run these two commands:

sudo yum -y install nodejs npm  # *
sudo npm install -g grunt

If you are using Debian or Ubuntu Linux,

 » Read more..

How Do You Install and Configure Gulp?

Problem scenario
You want to use Gulp the automation tool (https://gulpjs.com/).  How do you install it and get it to work on Linux (either a Debian distribution or a Red Hat distribution)?

Solution
1.  If you are using CentOS, Red Hat Enterprise Linux, or Fedora, run these two commands:

sudo yum -y install nodejs npm  # *
sudo npm install -g gulp

If you are using Debian or Ubuntu Linux,

 » Read more..

How Do You Install npm and Node.Js on Any Distribution of Linux?

Problem scenario
You have Linux servers of different distributions (including Debian/Ubuntu, Red Hat derivatives such as CentOS, RHEL, or Fedora, and Linux SUSE).  You want to install npm and Node.js on them.  What do you do?

Solution
Prerequisites
i.  You need a server with at least 1 GB of RAM.  To add virtual memory, see this posting

 » Read more..

How Do You Use “sudo npm” or “sudo node” Commands?

Problem scenario
You run “sudo npm” or “sudo node” and you get “command not found” error messages.  What should you do?

Solution
Modify the /etc/sudoers file.  Find the stanza with secure_path.  Append “:/usr/local/bin” (with no quotes) to the line.

Here is an example of how the stanza should look (it is often on line 80 of /etc/sudoers):

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

Once the /etc/sudoers file has been saved,

 » Read more..