How to install Node.js successfully

Matthew Nuzum —  — 12 Comments

I’ve learned a few tricks about installing Node.js that I thought I’d share. Nothing in here is hard and you’ve got a fighting chance of getting this right on your own with no help from me, but I did learn a few things the hard way and felt I should share them.

I’m going to be covering installation for Windows, Mac OS and Ubuntu Server (or any Ubuntu shell environment).

First, decide how you want to install. The decision criteria and process will differ based on your platform:


  1. Use the installer package from
    • If you can’t use that, then there is a Windows binary that you can use. Simply download it and run it. You’ll have to add it to your path and deal with npm. I won’t help you with this, but I figured it out and I bet you can too, if you want to. However, I recommend the installer package if you can possibly use it.
  2. During the installation, one of the default options is to install npm and another is to add node to your path. Do this!
  3. Now, when it’s time to use Node.js, in your start menu you have a new folder called Node.js and in this folder is a “Node.js command prompt.” Use this whenever you need to use the command line utilities such as npm or commands that come from globally installed modules.
  4. You’re done! Test it by opening your Node.js command prompt and run npm ls -g. You should see that you have an empty list, no modules installed globally.

Mac OS:

  1. Choose between installing via the installer or homebrew.
    • Homebrew is what I prefer but the installation has a couple extra steps. The benefits are: You can install global modules without needing to use sudo and you can easily update your node.js using homebrew. The disadvantage is that you need to install homebrew which requires the Xcode command line tools.
    • installer is quick and easy to download and install. It won’t auto-update, which can be a blessing or a curse. (sometimes upgrades change behavior and your apps or utilities will be incompatible with the new version) If you go this route, follow similar instructions to those of Windows above, the rest of these steps will discuss homebrew.
  2. Install Xcode from the Mac app store
  3. Once Xcode installs, open it and go to preferences and choose the download tab.
  4. Install the command line tools. This may require you to log in or create a free Apple developer account
  5. Visit and follow the instructions for installing homebrew (scroll down, you’ll see it)
  6. From a terminal, install Node.js with this command: brew install nodejs then install npm the same way, brew install npm.
  7. You’re done! Test it from your terminal by typing, npm ls -g, you should see an empty list, meaning you have no globally installed modules

Ubuntu command line:

  1. Choose between using the Ubuntu repo’s Node.js or a repo provided by the Node.js developers
    • I strongly suggest using the Node.js developers repo. You’ll get updates and have a recent version of Node on your computer
    • If you feel you’ll get better OS support or you depend on a software package that relies on the Ubuntu’s repo’s version of Node then use the package from the Ubuntu repositories. Simply do: sudo apt-get install nodejs and you’re done. The rest of these instructions will focus on using the Nodejs developer’s repos
  2. Visit the instructions to install the PPA for Node.js. A PPA is an add-on software repository that makes it easy to install 3rd party tools.
  3. You’re done! Test it from your terminal by typing npm ls -g. You should see an empty list, meaning you have no globally installed modules.

That is it. You now have Nodejs installed and you know how to use npm. You’re ready to take on the Node world!

If it helped, please share!Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+

Matthew Nuzum

Posts Twitter Facebook

Web guy, big thinker, loves to talk and write. Front end web, mobile and UX developer for John Deere ISG. My projects: @dsmwebgeeks @tekrs @squaretap ✝
  • thingsthings


  • brew install node or brew install nodejs??

  • newz2000

    @alexvallejo:disqus They both work, they are the same recipe.

  • Kevin Lyman

    When I typed “brew install npm” I received a warning saying “node-0.10.22 already installed” if I type “npm ls”, the list is empty but if I include “-g” the list has a lot on it.

    • newz2000

      I think you’re set, Kevin.

  • Laurence

    I’ve followed your suggestions for Windows installing but it keeps rolling back the installation after it sys creating short-cuts. I disable anti virus software during installation.

  • Sean

    Thanks for this write-up. FYI, it is no longer necessary to install NPM separately for OSX. Running ‘brew install node’ automatically include NPM.

    • newz2000

      Thanks, great tip!

  • Mike

    I’ve been all over the internet for about an hour, and your instructions are the only ones that work for a quick test of a Windows install. Your steps 2 and 3 in the Windows section are the “special sauce”.

    • newz2000

      That’s great, Mike! It’s always good to know that the work I’ve done has helped someone.

  • On a fresh Ubuntu install I get NodeJs 6… Why do they make it so hard?

    • newz2000

      If I had a nickel for every time I’ve asked myself that same question…
      The answer is because it’s the “debian way.” Some people prefer stability and consistent versions. RedHat has the same principle. If you deploy your software to Ubuntu, a security update or minor version update should not break compatibility of your application. Therefore whatever version was available when Debian was forked (at the beginning of the dev cycle) will be the version you get for the life of that product. 🙁