GoAdmio

nodejs

Install or reinstall Node.js (default version 22), plus npm, Git, and mudslide

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/nodejs installs Node.js on a GoAdmio server, together with the tools GoAdmio needs alongside it. It:

It works on CentOS, AlmaLinux, Rocky Linux, Red Hat, Fedora, Debian, and Ubuntu. The command runs sudo internally, so run it as root or as a user with sudo rights.

[!WARNING] The command removes the installed nodejs and npm packages before reinstalling them. Any service that runs on Node.js may stop or need a restart afterward.


Quick start

# Install Node.js 22 (the default)
/go/nodejs

Syntax

/go/nodejs [version]
Form Behavior
/go/nodejs Installs Node.js 22.
/go/nodejs <version> Installs the given Node.js major version, for example 20.

Every run is recorded in /var/log/go/nodejs.log, with the time and the arguments you passed.


Options

The command has one optional argument and no -- options.

Argument Required Default Notes
version No 22 A Node.js major version number, such as 18, 20, or 22. It is not checked before use.

[!NOTE] On Debian and Ubuntu the repository setup step uses NodeSource's RPM address (rpm.nodesource.com), which is meant for RPM-based systems. The version you pass may therefore not be honored there, and apt may install whatever Node.js version the system provides. Run node -v afterward to confirm what you got.


Output

The command prints no summary of its own. You see the output of the NodeSource setup script and of the package manager as it runs.

Outcome What you get
Supported operating system Package manager output, ending with the npm install -g mudslide result.
Unsupported operating system Unknown operating system. and exit status 1. Nothing is installed.

The script does not stop when a step fails. Later steps still run, and the exit status is that of the last command (npm install -g mudslide). Check the output for errors, then run node -v to confirm the install.

Log

Each run appends one line to /var/log/go/nodejs.log:

[Nov 21 12:00:00]# nodejs 20

Examples

# Install the default version (22)
/go/nodejs
# Install Node.js 20
/go/nodejs 20
# Check the installed versions
node -v
npm -v
# Check the OS value the command will use
cat /usr/local/goadmio/linux/os.db
# See recent runs of the command
tail /var/log/go/nodejs.log

Troubleshooting

Symptom Likely cause Fix
Unknown operating system. /usr/local/goadmio/linux/os.db holds a value other than CentOS, AlmaLinux, Rocky, Red Hat, Fedora, Debian, or Ubuntu. Check the file's contents. Install Node.js manually on unsupported systems.
Wrong Node.js version on Debian or Ubuntu The RPM setup script was used, so apt installed the distribution's own version. See the note under Options. Install the version you need manually from NodeSource's Debian repository.
The setup script fails to download The server can't reach rpm.nodesource.com. Check DNS, the firewall, and outbound access, then run again.
dnf module enable reports that the stream doesn't exist The version you passed isn't available for that system. Pass a supported major version such as 20 or 22.
npm install -g mudslide fails No network access to the npm registry, or npm didn't install. Run npm install -g mudslide by hand and read the error.
A Node.js service stopped after the run The command removes and reinstalls the packages. Restart the service.

Details

What it does on each operating system

The command reads the operating system name and version from /usr/local/goadmio/linux/os.db and /usr/local/goadmio/linux/version.db, then follows one of these paths.

Operating system Package manager Steps
CentOS 7 yum Add NodeSource repository, remove and install nodejs, install git, remove and install npm, install mudslide.
CentOS 8 and later dnf The same steps as CentOS 7, using dnf.
AlmaLinux, Rocky, Red Hat, Fedora dnf Add NodeSource repository, list and enable the nodejs:<version> module stream, upgrade all packages, remove and install nodejs, install git, remove and install npm, install mudslide.
Debian apt Run the NodeSource setup script, purge and install nodejs, install git, remove and install npm, install mudslide.
Ubuntu apt Run the NodeSource setup script, purge and install nodejs, install git, purge and install npm, install mudslide.

CentOS is matched first, so every CentOS version uses the yum or dnf path in the first two rows. It never reaches the module-stream steps in the AlmaLinux, Rocky, Red Hat, and Fedora row.

On the AlmaLinux, Rocky, Red Hat, and Fedora path, dnf -y upgrade updates every installed package, not only Node.js.

flowchart TD
    A["nodejs [version]"] --> B["Log the run, default version to 22"]
    B --> C{"Operating system"}
    C -- "CentOS" --> D{"Version 7?"}
    D -- "Yes" --> E["NodeSource setup, then yum: remove and install nodejs and npm, install git"]
    D -- "No" --> F["NodeSource setup, then dnf: remove and install nodejs and npm, install git"]
    C -- "AlmaLinux / Rocky / Red Hat / Fedora" --> G["NodeSource setup, enable nodejs module, dnf upgrade, reinstall nodejs and npm, install git"]
    C -- "Debian / Ubuntu" --> H["NodeSource setup, apt: purge and install nodejs, reinstall npm, install git"]
    C -- "Anything else" --> X["Unknown operating system, exit 1"]
    E --> M["npm install -g mudslide"]
    F --> M
    G --> M
    H --> M

See also

Command Description
mudslide Placeholder for WhatsApp helpers
send Send queued WhatsApp messages through logged-in devices
installphp Install a PHP version with its extensions and PHP-FPM service on a GoAdmio server
package Install all base packages required by GoAdmio