raspberry pi nodejs

Installing Node.js on a Raspberry Pi

Got yourself a Raspberry Pi? Let’s get started with Installing Node.js on a Raspberry Pi.

Before we get into action, what is really Node.js

Definition

from Wikipedia

Node.js is an open-source, cross-platformJavaScriptrun-time environment for executing JavaScript code server-side. Historically, JavaScript was used primarily for client-side scripting, in which scripts written in JavaScript are embedded in a webpage’s HTML, to be run client-side by a JavaScript engine in the user’s web browser.

By default Raspberry Pi actions are done using Python language. Node.js provides an alternative way to program actions on Raspberry Pi. We will cover more in later post on the difference between Node.js and Python in Raspberry Pi development. There are few versions of Node.js as listed here. Node.js with 0.xx versions are default nodejs before merging with IO.js. Node.js with 4.xx and later are after the merging. Currently IO.js team merged with Node.js team. All the functionality of IO.js has been made available in Node.js.

Let’s get started.

Instructions

  1. Make sure Raspberry Pi all set with OS. Can read more here on how to setup.
    Pixel OS
    Pixel OS
  2. Make sure Pixel OS up to date. You can do so by following command below
    apt-get update && apt-get upgrade -y
  3. By default PixelOS preinstaleld with NodeJS. So practically you can start to work on NodeJS projects. The package installed are Node.js before IO.js merger.
    To check installed version you can run the command below;

    node -v

    default nodejs installation

  4. You can find the released versions here.
  5. We will update the Node.js to the latest available version. Follow the commands below to update.
    curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
    sudo apt install nodejs 
    node -v
  6. Your Raspberry Pi should have been updated with latest version. So get started with Node.js projects.
    lastest nodejs on pi

Find Node.js projects on Techworked.

Share this:

Leave a Reply

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

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.