-
Notifications
You must be signed in to change notification settings - Fork 2
Node
Node, or Node.js, is an amazing Javascript engine written in C++ that lets you use the Javascript language to do things with this front-end language in the back end. It is dependent on Python, so I would recommend following my instructions for Python before installing Node.
For a while, Node did not work on ARM computers like the Raspberry Pi because Joyent ceased to work on Node for ARM. When the Linux Foundation took over Node from Joyent, that quickly changed. Now Node works on ARM.
Node requires GCC, Make, and Python (2 and 3, which should come with any current Raspbian image). If you are using Linux, you should already have these things.
You'll also want to install the following packages
- apt-transport-https
- lsb-release"
- curl
As of the March 2017 version of Raspbian, node is included, however it is a very old version (v0.10.29). But we can upgrade to a current build.
Node gives us several options for installing node. One way is Docker which I'm not quite familiar with just yet (maybe in the next update of this wiki), another is their Github, another way is to get the source tarball, and then their is the binary tarball for arm. The last two options have two options of their own: LTS (Long Term Service) or Stable. For binary and source options, I highly recommend choosing Stable over LTS, especially if there is a security issue.
For Raspberry Pi 2 and 3, you are using the newer ARMv7l architecture, so follow these instructions for the binary stable version. If you are unsure, run cat /proc/cpuinfo to show the process information and the model names will confirm this.
One other thing: DO NOT USE THE NODESOURCE SCRIPTS TO INSTALL NODE! First they still use Chris Lea's scripts which are depreciated, and secondly they still won't install the latest version of node. So you MUST install Node as follows.
$ cd ~/Software
$ curl -SL https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-armv7l.tar.xz | tar xJv
$ cd node-v7.8.0-linux-armv7l/
$ sudo cp -R * /usr/local # DO NOT FORGET the `-R` option!
$ sudo update-alternatives --install /usr/bin/node node /usr/local/bin/node 100 # Replace the existing aliasFor Raspberry Pi B+ users, you are using the older ARMv6l architecture, so follow these instructions.
$ cd ~/Software
$ curl -SL https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-armv6l.tar.xz | tar xJv
$ cd node-v7.8.0-linux-armv6l/
$ sudo cp -R * /usr/local # DO NOT FORGET the `-R` option!
$ sudo update-alternatives --install /usr/bin/node node /usr/local/bin/node 100 # Replace the existing alias-R argument on the cp command or you will have a bad time.
We also need to point the node alias to the version in /usr/local/bin. The proper way to do this is to use update-alternatives. The 100 is also important as it sets the priority of this redirect above the default one. When update-alternatives is used, a softlink from a target in /usr/bin is created to point to another target in /etc/alternatives which then points to our application which will be in /usr/local/bin. Only node needs this to be done, not npm. npm is good to go.
For any Pi, you can install Node from source from their Github using the following instructions
$ cd ~/Software
$ git clone https://github.com/nodejs/node
$ cd node
$ ./configure && make && sudo make install
$ sudo update-alternatives --install /usr/bin/node node /usr/local/bin/node 100 # Replace the existing alias, if one existsThat's it! No more meddling with the dot files, just download, change directories, copy everything, and RUN!
If you want to verify that node is ready try this and see the results.
$ whereis node
node: /usr/local/bin/node
$ which node
/usr/local/bin/node
$ node
> 2 + 2
4
>To leave the node shell, press CTRL+D
npm is Node's package manager. It is include with the node install.
TODO: explain how to use npm
TODO: show code examples here
- http://nodejs.org/
- https://github.com/joyent/node
- https://www.npmjs.com/
- http://forum.odroid.com/viewtopic.php?f=52&t=6548 - Fixing the Segmentation Fault bug for Node on ODroid
- https://nodejs.org/dist/latest/
- http://www.instructables.com/id/Easy-NodeJS-WebSockets-LED-Controller-for-Raspberr/
Setup
- [Assemble the Hardware](Assemble the Hardware)
- [Install the Software](Install the Software)
- SD Card Formatting and Image Mounting
- ❤️ [TLDR version](Install the Software#tldr)
- 🆕 [Windows version](Install the Software#doing-this-in-windows)
- 🆙 [Setup your Raspberry Pi](Setup your Raspberry Pi)
- [Download the Missing Parts](Download the Missing Parts)
- Clone this repo
- 🆕 [Install these first](Install these first)
-
Python(It's taken care of) - 🆙 CMake
- 🆙 Node
- 🆕 Expect (Tcl/Tk is not dead!)
- 🆙 tmux and ncurses
- 🆙 htop
- 🆙 wavemon
- Vim
- 🆙 Ruby
- 🆙 weechat
- 🆕 urxvt 256 color terminal!
- 🆕 i3 A better window manager
- 🆕 Ranger
- 🆙 Qt5
- 🆕 Chromium
wicd-curses- 📻 Software Defined Radio
- 🎮 [Linux Toys](Linux Toys)
Typical Utilities
- [Downloading and extracting with curl and tar](curl and tar)
- [Browsing with ls and cat](ls and cat)
- [Searching with grep and find](grep and find)
- [Filtering with sed and awk](sed and awk)
- [Piping with less, pv, and tee](less, pv, and tee)
- Monitor your system with htop
- Multiplex with tmux