Installing Node.js on your Raspberry Pi

Node.js is a common and powerful server environment for JavaScript, and is handy to be able to work with for just about any Raspberry Pi project — it’s also one of those libraries that often requires multiple Google searches to remember how to get it installed, so I’ve consolidated my steps down to a single page.  Hopefully, you’ll only need one search next time!  (and hopefully I’ll remember that I wrote this, so I won’t need any!)

  • Install Node.js – you might have a node installation on your Pi already, but chances are it’s not the one you want.  Instead, grab a fresh one:
    • curl -sL https://deb.nodesource.com/setup_9.x | sudo bash -
    • sudo apt-get install nodejs
    • Verify this worked with node -v and npm -v (as of this writing, I get 9.4.0 and 5.6.0, respectively)
  • Install the Yarn dependency manager, which we’ll use to run our app:
  • Install a few handy packages using apt-get – you might not need these, but I find them necessary for many of my projects
    • sudo apt-get update
    • sudo apt-get install build-essential libavahi-compat-libdnssd-dev git

That’s it – easy, when you have everything in place!

Advertisements

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s