Installing NPM from NodeJS source

Node.js Logo

The latest versions of NodeJS apparently come with npm. Here’s how to install it.

  1. Download nodejs source:
  2. Decompress it:
    tar zxvf node-x.y.z.tar.gz
  3. Enter the deps/npm directory:
    cd node-x.y.z/deps/npm
  4. Run the standard install process:
    sudo make install

You can also use `make latest` to install the latest version of npm. Using `make install` or `make link`install npm from the source directory.


The docs for npm mention that but don’t tell you how to install npm system-wide. They simply recommend you download some random shell script and run it. Downloading and running a shell script directly from the internet is a dangerous proposition and something you should never ever ever ever ever ever ever do.

If you wouldn’t run random Linux commands from an IRC chatroom, you shouldn’t run a random install script from the internet.

Leave a Reply and Share Your Thoughts