DEV Community

Little Coding Things Blog
Little Coding Things Blog

Posted on • Originally published at littlecodingthings.com on

How to Install NPM on MacOS

Read the original at our blog littlecodingthings.com**.

Installing Node.js and npm (Node Package Manager) on your Mac is super simple. With these tools, you can manage Javascript packages, create powerful web applications, and dive deep into modern web development. Start by following these steps:

Step 1: Verify that npm is installed

Open your terminal and type

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode
  • If you see version numbers (e.g., v16.13.0 for Node.js and 8.1.0 for npm), they’re already installed.
  • If you see errors or no versions, continue to the next step.

Step 2: Install Node.js (includes npm)

The easiest way to install Node.js and npm is via Homebrew. If you don’t have Homebrew installed, install it first.

Then run:

brew install node
Enter fullscreen mode Exit fullscreen mode

Step 3: Verify the Installation

After the installation completes, type the following command to check the versions and ensure everything is installed properly:

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

You should see version numbers for both. 🎉

Step 4: Update NPM (Optional)

npm updates frequently, so ensure you have the latest version:

npm install -g npm@latest
Enter fullscreen mode Exit fullscreen mode

🎉 You’re all set! Now, you can use Node.js and npm to manage and build amazing projects. Happy coding! 😊

Why Use Node.js and npm?

  • Fast & Scalable : Node.js enables fast, scalable network applications with non-blocking I/O.
  • Massive Ecosystem : npm offers access to over 1 million open-source packages.
  • Cross-Platform : Develop once and deploy anywhere.

These tools are essential for any web developer aiming to build modern, high-performance applications.

Top comments (0)