Mastering Node.js Installation: A Guide for Beginners





Avoiding Common Pitfalls and Streamlining Your Development Environment

Back when I started messing with Node.js, I’ve done a lot of Node.js installations more times than I’d like to admit. It’s easy to follow tons of tutorials where you’re asked to install node.js, only to realize later that you’ve inadvertently created a tangled web of conflicting Node.js versions. In this guide, I’ll share my hard-earned wisdom on how to ensure you have only one Node.js installed, saving you countless hours of frustration.

The Pitfalls of Blind Installation

It’s tempting to simply follow the first set of installation instructions you find online. However, this approach can lead to a messy setup in the long run. Instead, take a moment to understand the process and its implications.

Initially, you might not encounter any issues. All Node.js versions seem to coexist peacefully, and your projects run smoothly because all versions are the same. But this calm is deceptive.

Sooner or later, Node.js releases an update, and that’s when the trouble begins. Suddenly, the versions clash, and none of your installed packages seem to work.

After hours of troubleshooting, you’ll realize that Node.js needs an update. It’s a common step in any developer’s journey, but there’s a catch.

Even after the update, you might be perplexed to find that the Node.js version remains unchanged. This can be baffling, especially for beginners.

The Path to Clarity

To untangle this web, you first need to know how many Node.js versions are lurking in your system. Open your terminal and type:

$ node -v

You’ll likely see a version number. Don’t be surprised if it’s not the one you expected.

From here, you have a few options, I’ll just name two.

  1. Start searching for where all your node installations are. This was what I did and it’s been a long while, I no longer remember who I got rid of all my nodejs that installed via homebrew, terminal and whatever. I had to do a lot of googling.

  2. Install NVM. It’s a nifty tool called Node Version Manager. I haven’t tried this yet, but it seems this would have been the best way to go. Check out this article from freecodecamp about it.

At the moment, I don’t have NMV installed. I only have 1 node version installed for now and I may need multiple in the future. So it should be good to know. 😄

I hope this helps other beginners navigate the tricky waters of Node.js installations.

Cheers!