Node.js and npm in Linux: Essential Tools for JavaScript Developers
JavaScript is a widely used programming language that can run in the browser or on the server side. To run JavaScript on the server side, you need a JavaScript runtime environment, and Node.js is the most popular one. Node.js is built on Chrome's V8 engine, which lets you write high-performance, event-driven, asynchronous web applications using JavaScript. npm is the default package manager for Node.js, which allows you to easily install, update, and remove various JavaScript modules and packages.
In this article, we will teach you how to install the latest Node.js and npm in Linux, and how to use them to create and run your JavaScript applications. We'll cover three different installation methods: using apt to install nodejs packages from Ubuntu's default repository; using apt to install a specific version of nodejs package from an alternative PPA repository; installing nvm, the Node version manager, and using it to install and manage multiple versions of Node.js. Depending on your needs and preferences, you can choose one of these methods to start your JavaScript development journey.
Nodejs is a lightweight and efficient JavaScript platform built on Chrome's V8 JavaScript engine, and NPM is the default NodeJS package manager. You can use it to build scalable web applications.
This article will introduce:
- How to install Node.js 14 in CentOS, RHEL and Fedora
- How to install Node.js 14 in Debian, Ubuntu and Linux Mint
How to install Node.js 14 in CentOS, RHEL and Fedora
The latest versions of Node.js and NPM are available from the official NodeSource Enterprise Linux repository, which is maintained by the Nodejs website and you need to add it to your system to install the latest Nodejs and NPM packages.
IMPORTANT: If you are running RHEL 6 or an older version of CentOS 6, you may want to read about running Node.js on older distributions.
Installing NodeJS 14.x in RHEL, CentOS and Fedora
To add a repository for the latest version of Node.js 14.x, use the following command as a superuser or non-superuser.
————– As root user ————–
# curl -sL https://rpm.nodesource.com/setup_14.x | bash –
————– User with root privileges ————–
$ curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash –
Installing NodeJS 12.x on RHEL, CentOS and Fedora
If you want to install NodeJS 12.x, please add the following repository.
————– As root user ————–
# curl -sL https://rpm.nodesource.com/setup_12.x | bash –
————– User with root privileges ————–
$ curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash –
Installing NodeJS 10.x on RHEL, CentOS and Fedora
If you want to install NodeJS 10.x, please add the following repository.
————– As root user ————–
# curl -sL https://rpm.nodesource.com/setup_10.x | bash –
————– User with root privileges ————–
$ curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash –
Next, you can now install Nodejs and NPM on your system using the following commands:
# yum -y install nodejs
or
# dnf -y install nodejs
Optional: There are development tools, such as gcc-c, that you need to have installed on your system in order to build native plugins from npm.
# yum install gcc-c make
or
# yum groupinstall ‘Development Tools’
How to Install Node.js 14 in Debian, Ubuntu and Linux Mint
The latest versions of Node.js and NPM are also available from the official NodeSource Enterprise Linux repository, which is maintained by the Nodejs website and you need to add it to your system to install the latest Nodejs and NPM packages.
Installing NodeJS 14.x in Debian, Ubuntu and Linux Mint
——-On Ubuntu and Linux Mint ——-
sudo apt-get install -y nodejs
——- On Debian ——-
# curl -sL https://deb.nodesource.com/setup_14.x | bash –
# apt-get install -y nodejs
Installing NodeJS 12.x in Debian, Ubuntu and Linux Mint
——-On Ubuntu and Linux Mint ——-
sudo apt-get install -y nodejs
——- On Debian ——-
# curl -sL https://deb.nodesource.com/setup_12.x | bash –
# apt-get install -y nodejs
Installing NodeJS 10.x in Debian, Ubuntu and Linux Mint
——-On Ubuntu and Linux Mint——-
sudo apt-get install -y nodejs
——- On Debian ——-
# curl -sL https://deb.nodesource.com/setup_10.x | bash –
# apt-get install -y nodejs
Optional: There are development tools, such as gcc-c, that you need to have installed on your system in order to build native plugins from npm.
$ sudo apt-get install -y build-essential
Testing the latest Node.js and NPM in Linux
For a simple test of nodejs and NPM, you can check the version installed on your system using the following command:
On RHEL, CentOS and Fedora
# node –version
# npm –version
On Debian, Ubuntu and Linux Mint
npm –version

That’s it, Nodejs and NPM are now installed and ready to use on your system.
I believe these are simple steps, but if you run into problems, let us know and we'll find a way to help you. I hope you find this guide helpful and always remember to stay connected to linuxmi.com.
The above is the detailed content of Node.js and npm in Linux: Essential Tools for JavaScript Developers. For more information, please follow other related articles on the PHP Chinese website!

This guide explains how to automatically mount a USB drive on boot in Linux, saving you time and effort. Step 1: Identify Your USB Drive Use the lsblk command to list all block devices. Your USB drive will likely be labeled /dev/sdb1, /dev/sdc1, etc

Cross-platform applications have revolutionized software development, enabling seamless functionality across operating systems like Linux, Windows, and macOS. This eliminates the need to switch apps based on your device, offering consistent experien

Artificial Intelligence (AI) is rapidly transforming numerous sectors, from healthcare and finance to creative fields like art and music. Linux, with its open-source nature, adaptability, and performance capabilities, has emerged as a premier platfo

Looking for a fast, minimal, and efficient Linux distribution without a graphical user interface (GUI)? Lightweight, GUI-less Linux distros are perfect for older hardware or specialized tasks like servers and embedded systems. They consume fewer res

Wine 10.0 stable version release: Running Windows applications on Linux to a higher level Wine, this open source and free application, allows Linux users to run Windows software and games on Unix/Linux operating systems, ushering in the release of the 10.0 stable version! This version has been provided with source code and binary package downloads, and supports various distributions such as Linux, Windows and Mac. This edition embodies a year of hard work and over 8,600 improvements, bringing many exciting improvements. Key highlights include: Enhanced support for Bluetooth devices. Improve support for HID input devices. Optimized performance of 32-bit and 64-bit applications.

This tutorial guides you through installing SQL Server 2022 on RHEL 8.x or 9.x, connecting via the sqlcmd command-line tool, database creation, and basic querying. Prerequisites Before beginning, ensure: A supported RHEL version (RHEL 8 or 9). Sudo

Mozilla Thunderbird 135: Powerful cross-platform mail client Mozilla Thunderbird is a free, open source, cross-platform email, calendar, news, chat and contact management client designed to efficiently handle multiple email accounts and news sources. On February 5, 2025, Mozilla released the Thunderbird 135 version, introducing a number of new features, performance improvements and security fixes. Thunderbird 135 main features: XZ Packaging for Linux Binaries: Smaller files, faster unpacking, and better integration with modern distributions. Cookie storage support: when creating space

This guide demonstrates how to protect files on Linux from accidental renaming or deletion using simple commands. We'll use the file important.txt in /home/user/ as an example. Method 1: Using chattr for Immutability The chattr command modifies fil


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
