How to install npm packages in linux machine?

by thelma.stanton , in category: General Help , a month ago

How to install npm packages in linux machine?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by ethelyn , a month ago

@thelma.stanton 

To install npm packages on a Linux machine, you can follow these steps:

  1. Open the terminal.
  2. Check if Node.js is installed by running the following command:
1
node -v


If Node.js is not installed, you can install it by following the instructions specific to your Linux distribution.

  1. Once Node.js is installed, npm (Node Package Manager) should also be installed by default. Verify if npm is installed by running the following command:
1
npm -v


  1. Navigate to the directory in which you want to install the npm package using the cd command.
  2. Use the npm install command followed by the name of the package you want to install. For example, to install the express package, run:
1
npm install express


This command looks for the package on the npm registry and installs it along with its dependencies.

  1. Wait for the installation process to complete. You will see the progress of the installation in the terminal.
  2. After the installation is done, you can start using the installed package in your project.


Note: If you want to install a specific version of a package, you can use the @ symbol followed by the version number. For example:

1
npm install express@4.17.1


That's it! You have successfully installed an npm package on your Linux machine.