How to Use 'npm install' Command Line Interface

Getting Started with npm on Windows

To install npm on Windows, download and install Node.js from the official Node.js website. The npm package manager is included in the installation. Follow the installer steps to complete the setup.

Getting Started with npm on Linux

For Linux users, install Node.js and npm via your package manager. For Debian and Ubuntu based distributions:

sudo apt update
sudo apt install nodejs npm

For Fedora, CentOS, or RHEL:

sudo dnf install nodejs npm

Verify the installation of Node.js and npm by running:

node -v
npm -v

First Steps After Installing npm

Once npm is installed, you can start installing packages. For example, to install the React library:

npm install react

You can also create a new Node.js project by initializing a new package.json file:

npm init

Common npm Commands

Troubleshooting

If you encounter any issues during the installation, ensure that your system's PATH includes the directory where Node.js and npm were installed. You can also check the npm community and documentation for solutions.

Next Steps

Now that you have npm installed, you're ready to start using it to manage your project's dependencies. For a detailed guide on how to use the npm install <package> command to add new libraries and tools to your projects, visit our How to Use 'npm install' Command Line Interface page. This guide will provide you with all the information you need to begin installing and managing npm packages effectively.