To install Node.js and npm, you can follow these steps depending on your operating system:
For Ubuntu (Linux):
-
Update your package index:
sudo apt update -
Install Node.js and npm:
sudo apt install nodejs npm
For macOS:
You can use Homebrew to install Node.js and npm:
-
Install Homebrew if you haven't already:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install Node.js (npm is included):
brew install node
For Windows:
- Download the Node.js installer from the official Node.js website.
- Run the installer and follow the prompts. npm will be installed automatically with Node.js.
Verify Installation:
After installation, you can verify that Node.js and npm are installed correctly by running:
node -v
npm -v
This will display the installed versions of Node.js and npm.
