How to Install Node.js and npm – Deployment Guide?

How to Install Node.js and npm – A Comprehensive Guide

Node.js is a free runtime environment across different platforms. It enables the use of JavaScript not just for developing client-side applications but also for creating server-side applications.

This step-by-step tutorial will walk you through installing Node.js and npm for building and running modern applications.

Node.js Environment Hosting

Node.js Environment Hosting

Create a New Environment

Create a New Environment

To deploy a Node.js app, you must utilize the Topology Wizard, which is powerful & easy to use.

Navigate to the Node.js tab, pick the necessary engine version for your app server, and add any additional software stack needed. If necessary, modify other parameters like cloudlets and node count, Public IPv4, etc.

Node.js app Configure

Node.js Versioning

The following Node.js version support right now:

  1. 14.21.3
  2. 16.20.0

Node.js Versioning

When creating a new environment, you can directly choose the required Node.js version from the topology wizard and adapt it to the current one via container redeployment.

Node.js Application Deployment

Following methods to deploy managed NodeJS application servers automatically:

  • Uploading an application archive from a local computer or external URL
  • Remote VCS repository (e.g., GitHub)

Node.js Application Deployment

Each newly generated Node.js application server on the platform comes pre-configured with Yarn and
npm support, the two primary package managers for this language. Both run the identical npm registry, which hosts many specialized software packages and offers standardization and automation of installation, update, configuration, and removal processes.

For archive or Git deployment procedures via the platform dashboard, the >npmpackage manager will be used by default.

Node.js Package Managers

The installation, update, configuration, and removal operations are standardized and automated via a built-in development tool known as Package Manager in the NodeJS application server.

Save $100 in the next
5:00 minutes?

Register Here

Node Package Manager (npm)

Installing pre-built apps and extra modules and packages necessary for your project may be done with the help of the Node Package Manager.

There are two ways to use npm to install essential Node.js packages:

  1. Include a list of necessary ones in the NodeJS dependencies section package.json file in the project’s root directory. When the application server starts, npm will automatically fetch and install such packages. The newly listed modules are included in this package.json file and added after the NodeJS node restart.
  2. Use SSH Gate to connect to the container and use the following commands to manage your packages manually:
  • npm search {package_name} – search module using name
  • npm install {package_name} – to install the required module
  • npm uninstall {package_name} – uninstall the module that was previously installed
  • npm update {package_name} – to update its latest version to the specified module
  • npm ls installed – to list already installed packages

Save $100 in the next
5:00 minutes?

Register Here

Domains Management

Adding a custom domain name to your Node.js app is more straightforward than using the default one. Depending on your environment topology, there are two options available.

Domains Management

In development and testing environments, you need to use CNAME redirect when utilizing a Shared Load Balancer.

If you use a Public IP, you should use a DNS A Record. This record type can handle high-traffic loads and is ideal for production environments.

You can easily redirect traffic between your environments, such as switching customers to a newer version of an application without any downtime. Done using the swap domains feature or the SwapExtIps API/CLI method.

Automatic Vertical Scaling

Our platform automatically adjusts your nodes’ RAM and CPU resources based on the current load without manual intervention.

It means you won’t overpay for unused resources and saves you time by eliminating the need to handle adjustments related to load or architectural changes.

Automatic Vertical Scaling Server

To optimize your NodeJS application server, specify the maximum number of cloudlets allowed (each with 128 MiB of RAM and 200 MHz of CPU). The platform will handle the rest automatically.

Manual Horizontal Scaling

To adjust the number of NodeJS application servers, navigate to the topology wizard and use the +/- buttons in the Horizontal Scaling section. Additionally, in the 5.5 platform version and onwards, you can modify the preferred scaling mode.

  • Stateless – The base image template creates all new nodes simultaneously.
  • Stateful -The file system of the master container replicates the new nodes in sequence.

Save $100 in the next
5:00 minutes?

Register Here