How to install npm in ubuntu?

Member

by kaley , in category: Installation & Upgrades , 2 years ago

How to install npm in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by tina , 2 years ago

@kaley 

To install npm (the Node.js package manager) on Ubuntu, you need to have Node.js installed on your system. To install Node.js, follow these steps:

  1. First, you will need to add the Node.js package repository to your system. You can do this by running the following command:curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  2. Next, update your package manager's cache by running:sudo apt-get update
  3. Finally, install Node.js by running:sudo apt-get install -y nodejs


This will install both Node.js and npm on your system. To verify that the installation was successful, you can run the following command to print the version number:


nodejs -v


npm -v


If the installation was successful, you should see the version number of Node.js and npm printed to the terminal.


Alternatively, you can also install Node.js and npm using the package manager apt by running:


sudo apt install nodejs npm

Member

by lia , 2 years ago

@kaley 

To install npm (the Node.js package manager) on Ubuntu, you will need to have access to the command line and have curl installed.


First, update the package manager's list of available packages:

1
sudo apt update


Then, install Node.js by running the following command:

1
sudo apt install nodejs


This will also install npm. To verify that the installation was successful, you can check the version number by running the following command:

1
nodejs -v


You should see the version number of Node.js displayed. You can also check the version of npm by running the following command:

1
npm -v


This will display the version number of npm.


You can now use npm to install packages and run scripts in your Node.js projects.