sudo apt install nodejs
sudo apt install npm 
Answer from abdelrahman aboneda on Stack Overflow
๐ŸŒ
npm
docs.npmjs.com โ€บ downloading-and-installing-node-js-and-npm
Downloading and installing Node.js and npm | npm Docs
To publish and install packages to and from the public npm registry or a private npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager like nvm to install Node.js and npm.
Discussions

Unable to install npm/node on Ubuntu 24.04 LTS instance
I'm working on a class assignment and my setup script suddenly started failing today. Looking into the logs, I can see that `sudo apt install npm -y --fix-missing` is failing with the following err... More on repost.aws
๐ŸŒ repost.aws
3
0
March 8, 2025
What's the command to install Node on Ubuntu?
https://nodejs.org/en/download More on reddit.com
๐ŸŒ r/MeshCentral
10
0
May 12, 2025
How do I install nodejs from the downloaded file on Ubuntu?

I'm not sure what file you have, but you might either want to add the ppa to get more current versions via apt or use nvm to install and switch between multiple versions. Instructions for both: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04

More on reddit.com
๐ŸŒ r/node
6
0
August 16, 2017
I'm trying to install node.js and npm on Ubuntu (WSL2). But its giving me error. Can someone help me out ?
Also, if you simply want node & npm on an Ubuntu machine, you should be able to install them via the package manager: sudo apt install nodejs npm More on reddit.com
๐ŸŒ r/bashonubuntuonwindows
15
8
July 19, 2021
People also ask

How do I update npm Ubuntu?
Run: sudo npm install -g npm@latest or, if using nvm: nvm install-latest-npm This keeps your environment secure and up to date.
๐ŸŒ
monovm.com
monovm.com โ€บ ๐Ÿ“š tutorials ๐Ÿ“š โ€บ how to install npm on ubuntu: a step-by-step guide
How to Install npm on Ubuntu: A Step-by-Step Guide
Can I install npm without Node.js?
No. npm is bundled with Node.js. Installing Node.js automatically provides npm. For maximum flexibility, use nvm to install both.
๐ŸŒ
monovm.com
monovm.com โ€บ ๐Ÿ“š tutorials ๐Ÿ“š โ€บ how to install npm on ubuntu: a step-by-step guide
How to Install npm on Ubuntu: A Step-by-Step Guide
Why is npm not found after installation?
This usually means npm isnโ€™t in your PATH. Either reinstall via nvm or manually export the npm binary directory into your PATH (~/.npm-global/bin).
๐ŸŒ
monovm.com
monovm.com โ€บ ๐Ÿ“š tutorials ๐Ÿ“š โ€บ how to install npm on ubuntu: a step-by-step guide
How to Install npm on Ubuntu: A Step-by-Step Guide
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ how-to-install-node-js-on-ubuntu-20-04
How to Install Node.js on Ubuntu | DigitalOcean
May 2, 2025 - Learn how to install Node.js on Ubuntu using apt, NodeSource, and NVM. Choose the best method for your needs with this beginner-friendly guide
๐ŸŒ
MonoVM
monovm.com โ€บ ๐Ÿ“š tutorials ๐Ÿ“š โ€บ how to install npm on ubuntu: a step-by-step guide
How to Install npm on Ubuntu: A Step-by-Step Guide
October 4, 2025 - In this guide, weโ€™ll cover what npm is, why you need it, and multiple methods to install npm Ubuntu (including Ubuntu 22.04, 20.04, and older versions).
๐ŸŒ
Cherry Servers
cherryservers.com โ€บ home โ€บ blog โ€บ linux โ€บ how to install npm on ubuntu 24.04 (3 methods)
How to Install NPM on Ubuntu 24.04 (3 Methods) | Cherry Servers
March 26, 2025 - Learn how to install NPM on Ubuntu 24.04 using three methods: default repository, NodeSource, and NVM. This guide helps manage JavaScript dependencies efficiently.
Find elsewhere
๐ŸŒ
Node.js
nodejs.org โ€บ en โ€บ download
Node.js โ€” Download Node.jsยฎ
with npm ยท InfoWant new features sooner? Get the latest Node.js version instead and try the latest improvements! BashCopy to clipboard and their installation scripts are not maintained by the Node.js project. If you encounter any issues please visit 's website ยท
๐ŸŒ
Hostinger
hostinger.com โ€บ home โ€บ how to install node.js on ubuntu automatically and manually
How to install node.js on Ubuntu automatically and manually
September 3, 2025 - Install Node.js from the local Ubuntu repository using this command. Confirm installation by pressing Y and Enter: ... Configure the Node Package Manager (NMP), which you will use to manage Node.js and JavaScript dependencies: ... Check Node.js and NPM version numbers to verify that both are installed correctly by running these commands subsequently:
๐ŸŒ
Vultr
docs.vultr.com โ€บ how-to-install-nodejs-and-npm-on-ubuntu-2204
How to Install Node.js and NPM on Ubuntu 22.04 | Vultr Docs
April 29, 2025 - Learn to install Node.js and NPM on Ubuntu 22.04 using NodeSource PPA and manage versions with NVM efficiently.
๐ŸŒ
Hostman
hostman.com โ€บ tutorials โ€บ how to install node.js and npm on ubuntu 24.04
How to Install Node.js and NPM on Ubuntu | Hostman
August 28, 2025 - Learn how to install Node.js and npm on Ubuntu machines, learning how to use NVM to install selected Node.js versions.
Price ย  $
Call ย  +1 844 286 2130
Address ย  1999 Harrison St 1800 9079, 94612, Oakland
๐ŸŒ
AWS re:Post
repost.aws โ€บ questions โ€บ QUDyoCxqpYQAWPcFaoOkokWw โ€บ unable-to-install-npm-node-on-ubuntu-24-04-lts-instance
Unable to install npm/node on Ubuntu 24.04 LTS instance | AWS re:Post
March 8, 2025 - The error has occurred for me a few times. It usually happens because Ubuntu repository is being updated, and files are not in sync. Do sudo apt update and try sudo apt install npm -y again.
Top answer
1 of 16
269

Fresh installation

Use the NodeSource PPA. For details look at the installation instructions. First, choose the Node.js version you need and add the sources for it:

v=8   # set to 4, 5, 6, ... as needed
curl -sL https://deb.nodesource.com/setup_$v.x | sudo -E bash -

Then install the Node.js package.

sudo apt-get install -y nodejs

P.S.: curl package must be installed on server for these code lines.

Upgrading

If you have nodejs already installed and want to update, then first remove current instalation and install it again using scripts above.

sudo apt-get purge nodejs npm
2 of 16
180

Generally speaking, loading arbitrary data from a URL into a root shell session is not a good idea and I wish people would stop peddling it as a solution for everything - "Please just run this script I'm sending you, and also while we're at it - I have a bridge you'd probably be interested in purchasing".

As an alternative, here's the "Ubuntu Way" of doing the same, where you can see how the system is being updated and know what repositories and what keys are added to your system configuration:

curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://deb.nodesource.com/node_7.x $(lsb_release -sc) main"
sudo apt-get update
sudo apt-get install nodejs

And here's the "post deprecation of apt-key way" of doing the same thing:

curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_7.x $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/nodejs.list
sudo apt update
sudo apt install nodejs

This is for the latest (at time of writing) Nodejs version 7. Other versions can also be gotten with a simple change to the repo URL - consult nodesource.com documentation for details.

๐ŸŒ
BlueVPS
bluevps.com โ€บ blog โ€บ how to install node.js on ubuntu 22.04: step-by-step guide
How to Install Node.js on Ubuntu 22.04: Step-by-Step Guide - Blog - BlueVPS
Once you update all repositories on your system, install Node.js on the Ubuntu 22.04 system using the following command: After executing the command above, you need to confirm the user confirmation prompts, and then it will install Node.js and npm (Node Package Manager) on your system.
๐ŸŒ
DedicatedCore
dedicatedcore.com โ€บ home โ€บ how to install node.js on ubuntu (22.04, 23.04)
Install Node.js and NPM on Ubuntu 23.04 (Easy #3 Stages)
August 17, 2024 - Using the Ubuntu package manager to install Node.js is the simplest. The most recommended approach. This method entails downloading the most recent versions of Node.js. Also npm from the Ubuntu repository. Installing them using the apt package manager. The majority of consumers are advised to choose this technique.
๐ŸŒ
Medium
medium.com โ€บ @micodin0plant โ€บ installing-up-nodejs-latest-and-npm-latest-on-ubuntu-22-04-5523d3dbb8e7
Installing up NodeJs (latest) and Npm (latest) on Ubuntu 22.04 | by Michael | Medium
April 29, 2024 - sudo apt-get update sudo apt install node sudo apt install npm ยท Once those a successfully installed check the versions using ... Updating NodeJs can be a little bit more tricky, I recommend using node version manager (nvm) to manage multiple ...
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ how-to-install-node-js-on-ubuntu-22-04
How to Install Node.js on Ubuntu (Step-by-Step Guide) | DigitalOcean
May 28, 2025 - $ sudo apt-get update -y $ sudo apt-get install -y ca-certificates curl gnupg $ sudo mkdir -p /etc/apt/keyrings $ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg $ NODE_MAJOR=20 $ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list $ sudo apt-get update $ sudo apt-get install -y nodejs $ node -v v20.6.1 $ npm -v 9.8.1 ... This guide provides detailed instructions for installing Node.js on an Ubuntu 22.04 server using three different methods.
๐ŸŒ
RoseHosting
rosehosting.com โ€บ home โ€บ how to install node.js and npm on ubuntu 20.04
How to Install Node.js and npm on Ubuntu 20.04 | RoseHosting
June 3, 2022 - In this tutorial, we will show you several ways to install Node.js and npm on Ubuntu 20.04 server.
๐ŸŒ
Linuxize
linuxize.com โ€บ post โ€บ how-to-install-node-js-on-ubuntu-20-04
How to Install Node.js and npm on Ubuntu 20.04 | Linuxize
December 24, 2023 - In this tutorial, we will guide you through three different methods of installing Node.js and npm on Ubuntu 20.04.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ installation guide โ€บ how-to-install-node-js-and-npm-on-ubuntu
How to Install Node.js and npm on Ubuntu? - GeeksforGeeks
July 23, 2025 - First, go to the start menu of the Ubuntu system and open the terminal, you can also use the shortcut key (CTRL+ALT+T) to open the terminal. Now you simply need to run the following command that will Install Node.js and npm on Ubuntu using the apt:
๐ŸŒ
LinuxHostSupport
linuxhostsupport.com โ€บ home โ€บ how to install node.js and npm on ubuntu 24.04
How to Install Node.js and NPM on Ubuntu 24.04 | LinuxHostSupport
May 30, 2024 - Letโ€™s run the command below to install them. $ sudo apt install curl apt-transport-https ca-certificates gnupg ยท The easiest way to install NodeJS and NPM on an Ubuntu 24.04 system is from the default APT repository.