Intern
How to install Node.js on Astra?
sobes.tech AI
Answer from AI
To install Node.js on Astra Linux, you can use the following methods:
-
Via apt repositories: This is the recommended way, as it provides easy updates and dependency management.
- Update the package list:
sudo apt update - Install Node.js and npm:
sudo apt install nodejs npm
- Update the package list:
-
Using n (Node.js version manager): This version manager is convenient for installing and switching between different Node.js versions.
- Install n:
sudo npm install -g n - Install the latest stable version of Node.js:
sudo n lts - You can install a specific version, for example:
sudo n 18.12.1 - View the list of installed versions and select the active one:
n
- Install n:
-
From source code: This method is more labor-intensive but allows you to get the latest version or compile Node.js with specific options.
- Download the source code from the official Node.js website.
- Unpack the archive.
- Build and install:
cd node-<version> ./configure make sudo make install
After installation, regardless of the method, you should verify the success of the installation:
node -v
npm -v
Both commands should output the versions of Node.js and npm, respectively.