Install Node.js & NPM on Debian Stable (Wheezy / 7)

Node.js is not a first class citizen in Debian yet. Installing it is easy but not entirely straight forward.

Update 2015/05/10: Jessie is the new Debian Stable and Node.js has much better support for it. Here are their instructions for installation.

Update 2015/04/13: The curl instruction has been updated according to the NPM documentation.

Update 2014/10/27: The nodejs package is now only available in backports for Wheezy (Stable), but is in Jessie (Testing) and Sid (Unstable). Follow the instructions in this post to install wheezy-backports.

We can install Node.js with the following command (for best results run all these commands as root):

# aptitude -t wheezy-backports install nodejs

‘-t wheezy-backports’ can be left out if you are using a newer release than Wheezy/Stable.

This will install Node.js, but as the command nodejs, not node as per normal. You can stop here, if all you intend to do is run Node.js and can remember that it is now called nodejs. But if you want to install NPM you need to continue.

First we want to be able to use the command node (if only because the NPM install expects it), to do this we use Debian’s update-alternatives command:

# update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100

Finally we can install NPM. It is not in installed with Node.js nor does it seem to be in the repositories, so we need to install it like so:

# curl | sh

You can test your install with the following commands:

# node -v
# npm -v

25 thoughts on “Install Node.js & NPM on Debian Stable (Wheezy / 7)”

  1. Thank you so much for posting these instructions. I just spent three hours using instructions on github where it states “npm comes with node now.” I met partial success changing node to nodejs in and then was stuck while the “man” files were being built.

  2. Meanwhile update-alternatives is not necessary anymore, as in wheezy-backports the package nodejs-legacy is available, which brings the node binary :_)

  3. hi there,
    in jessie nodejs and npm both are installed. See

    $ nodejs -v

    $ npm -v

  4. Thanks!

    Next warnings during installing NPM:

    cleanup prefix=/usr
    find: `/usr/lib/node’: No such file or directory
    find: `/usr/lib/node’: No such file or directory

  5. I’m on Debian 7.7, and I can guarantee that nodejs is not in the repository.

    1. Thanks “Nope”. I have updated the article to explain that nodejs is now only available in backports on Wheezy / Stable.

  6. I am getting this error and no file is downloaded. Any idea why?
    $ sudo curl | sudo sh
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 51 100 51 0 0 1146 0 –:–:– –:–:– –:–:– 1821
    sh: 1: Moved: not found

  7. Hi. I followed the steps but got stuck on running
    ‘aptitude -t wheezy-backports install nodejs’
    but I get this error:
    No candidate version found for nodejs

    Is there something I missed?

    (I am using debian wheezy 7.8)

    1. maybe you do not add ‘wheezy backports’ repository in /etc/apt/sources.list or do not run ‘apt-get update’ after previous action. so check it.

      $ sudo nano /etc/apt/sources.list

      and put there the line (if it not exist yet):
      deb wheezy-backports main

      save, exit, and type in terminal
      $ sudo apt-get update

      and finally
      $ sudo apt-get -t wheezy-backports install nodejs

  8. I want nodejs v5.5.0 and NPM v3.3.12

    how to update from 5.0.0 to v5.5.0

    for debian 7

  9. on my side, It almost worked but I got this:

    curl | clean=yes sh
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 6263 100 6263 0 0 7958 0 –:–:– –:–:– –:–:– 8176
    tar (GNU tar) 1.26
    Copyright (C) 2011 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later .
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by John Gilmore and Jay Fenlason.
    install npm@latest
    npm ERR! Object function (err) {
    npm ERR! if (err) return cb(err)
    npm ERR! fs.fsync(fd, function (err) {
    npm ERR! if (err) return cb(err)
    npm ERR! fs.close(fd, cb)
    npm ERR! })
    npm ERR! } has no method ‘toLowerCase’
    It failed

    So in the end, it fails, but I just don’t know what to do, any idea?


Leave a Reply

Your email address will not be published. Required fields are marked *