Home > node.js, raspberry pi > Install node.js on Raspberry PI in two simple steps

Install node.js on Raspberry PI in two simple steps

[ Updated Jan 20, 2013 ] Check out my git repository https://github.com/midnightcodr/rpi_node_install if you are interested in putting newer version of node to raspberry pi (tested with 0.8.14, os runs raspbian)

1) Install the newest wheezy image onto the sd card (currently 2012-07-15-wheezy-raspbian.zip) from http://www.raspberrypi.org/downloads

2)

sudo apt-get install nodejs npm

, press y, Enter when prompted, you will get node.js (v0.6.19) and npm (1.1.4) installed in a few minutes, which should be the easiest way to get node.js and npm up and running on RP.

Note: If you want newer version of node.js you might want to check this out: http://www.raspberrypi.org/phpBB3//viewtopic.php?f=34&t=9929, I have tested the method described in this post in the previous release of wheezy (http://www.raspberrypi.org/archives/1435) and I assume it should work with the current image as well.

Advertisements
Categories: node.js, raspberry pi
  1. August 12, 2012 at 5:30 pm

    doesn’t work!!!

    • August 16, 2012 at 4:51 am

      Wouldn’t it be better if you could share the problem you experienced in detail instead of putting “doesn’t work” as comment?

  2. Bosstiger
    September 10, 2012 at 9:24 am

    Reblogged this on Gigable – Tech Blog.

  3. October 7, 2012 at 1:08 am

    Do you know what repository one needs to include to install via apt?

    • October 7, 2012 at 3:20 am

      No external repository is required. My raspberry pi is running the latest raspbian (wheezy/sid) with the following repository:

      pi@raspberrypi ~ $ cat /etc/apt/sources.list
      deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
      

      If you have problem installing node.js and npm, make sure you run the followings before installing them:

      sudo apt-get update

      • October 7, 2012 at 6:35 am

        Ah, thanks ricoh3n! I’m still on squeeze – time to upgrade it seems

      • October 7, 2012 at 5:07 pm

        No problem. Upgrade to the newest version (wheezy) is strongly recommended. In addition to solving the nodejs/npm installation problem, you would also get the benefit of easy overclocking (via the new raspi-config, see http://www.raspberrypi.org/archives/tag/overclocking for detail).

  4. Marcus
    February 20, 2013 at 11:38 pm

    I installed node. Typing node, nothing happens? Not even a little “Hello World” is working:

    test.js:
    var sys = require(“sys”);
    sys.puts(“Hello World”);

    Trying: pi@raspberrypi ~ $ node test.js
    has the response: pi@raspberrypi ~ $

    node doesn’t work?

    Marcus

    • February 21, 2013 at 12:37 am

      What are the outputs of the following commands:

      which node

      file `which node`

      • Marcus
        February 21, 2013 at 4:30 pm

        Thank You for trying to help!

        The result of the commands:

        pi@raspberrypi ~ $ which node
        /usr/sbin/node
        pi@raspberrypi ~ $ file `which node`
        /usr/sbin/node: symbolic link to `ax25-node’
        pi@raspberrypi ~ $

        It seems to be the wrong node? How can I correct this?

      • February 21, 2013 at 10:12 pm

        Seems on your rpi you have package ax25-node installed. The command that comes with it (ax25-node) is symlinked to /usr/sbin/node (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907). You have a couple of options:

        1. Remove symlink /usr/sbin/node and run ax25-node using command ax25-node if you need to, or

        2.Enter the full path of node (for node.js) when running js scripts, for example: /usr/bin/node test.js

  5. September 7, 2013 at 4:14 am

    node and npm is removed – apt cannot locate package.

    debian wheezy is up to date, sudo apt-get upgrade and sudo apt-get update both say so.

  6. September 29, 2013 at 11:18 pm

    Chris, you might want to check out the node installation script for rpi https://github.com/midnightcodr/rpi_node_install

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: