masonjames
Posts: 2
Joined: Sat Sep 12, 2015 4:51 pm

Install (or update) to Node v4.0

Sat Sep 12, 2015 5:20 pm

Hiya everyone!

So, I've been running my raspberry pi 2 B+ for a few weeks now and learning a whole bunch - very awesome resources here on the forums!

tl;dr ~ What's the best way to update node.js from .12.x to 4.0 on raspbian wheezy?

I've been running a node v0.12.2 and it's worked well for a couple ideas I've wanted to implement, but now that node v4.0.0 is out I thought "why not try to break everything and upgrade to the latest!?"

So I went to the sources: https://nodejs.org/dist/latest/

I grabbed the one that I believe is right for my model (node-v4.0.0-linux-armv6l.tar.gz)

To download and unpack I did the following following this post (http://elinux.org/Node.js_on_RPi):

Code: Select all

wget https://nodejs.org/dist/latest/node-v4.0.0-linux-armv6l.tar.gz
tar -xzf node-v4.0.0-linux-armv6l.tar.gz
cd node-v4.0.0-linux-armv6l
Then I went to go forward with the install by doing the following:

Code: Select all

./configure
make
sudo make install
Only too bad for me because I get the whole "-bash: ./configure: No such file or directory"

Which is where I'm stuck. Previously, I had used the installation instructions (and downloaded node from):
http://conoroneill.net/node-v0122-for-a ... -odroid-c1

Those instructions say to run:

Code: Select all

sudo cp -R * /usr/local/
cd
Should I continue to do that to update nodejs?

fivdi
Posts: 208
Joined: Sun Sep 23, 2012 8:09 pm
Contact: Website

Re: Install (or update) to Node v4.0

Tue Sep 15, 2015 5:26 pm

Most of the files at https://nodejs.org/dist/latest/ are binaries and therefore don't need to be compiled. For example, node-v4.0.0-linux-armv6l.tar.gz contains the Node.js v4.0.0 binaries for ARMv6 machines like the Pi 1. They'll also work on the Pi 2 which is an ARMv7 machine.

You mention that you have a Raspberry Pi 2. An excellent source of precompiled Node.js binaries for ARMv7 machines like the Pi 2 is NodeSource. The instructions for installing practically any version io.js or Node.js on a Pi 2 can be found here: https://github.com/nodesource/distributions

audstanley
Posts: 10
Joined: Fri Nov 28, 2014 12:44 am

Re: Install (or update) to Node v4.0

Sat Jan 02, 2016 8:01 pm

I've made instructions on installing Node v5.3.0 on the raspberry pi 2 (or 1), just view the readme.md at
https://github.com/audstanley/Node-MongoDb-Pi/

If you are on a raspberry pi 2, you can run this block of code, and this will install nodeJS v.5.3.0, as well as download and compile mongodb, and create a mongodb user. If you only want to install node, just open up the github link, and copy paste up to line 24 into your terminal, and you'll be up and running with version 5.3.0 of nodeJS. If you want to install NodeJS AND MongoDB, just run this:

FOR RASPBERRY PI 2:

Code: Select all

sudo apt-get install git; 
git clone git://github.com/audstanley/Node-MongoDb-Pi; 
cd Node-MongoDb-Pi; 
sudo bash Install-Node-MongoDb-Pi-sh; 
This process will take about 4-5 hours on a raspbery pi 2.
...............................................................................................................................................................................




FOR AN OLDER VERSION OF THE RASPBERRY PI (NOT 2):

Code: Select all

sudo apt-get install git; 
git clone git://github.com/audstanley/Node-MongoDb-Pi;
cd Node-MongoDb-Pi; 

go into the script with your favorite text editor, vim, nano, whatever, and change every where that says "arm7l" to "arm6l"
then you can run the script:

Code: Select all

nano Install-Node-MongoDb-Pi-sh
Ctrl+X, then Y, then Enter to save and exit nano.


Code: Select all

sudo bash Install-Node-MongoDb-Pi-sh; 
This process will take about 4-5 hours on a raspbery pi ("other than 2").
...............................................................................................................................................................................

rdmello
Posts: 1
Joined: Mon May 16, 2016 3:16 pm

Re: Install (or update) to Node v4.0

Mon May 16, 2016 3:22 pm

Thank you for the shell script to update Node. I am also updating to Node v6.1.0 on a Raspberry Pi Zero (using the armv6l binaries). However, when I try to symbolic link /usr/bin/node to /opt/nodejs/bin/node, I get an error:

Code: Select all

ln: failed to create symbolic link ‘/usr/bin/node’: File exists
I guess that this is due to the old node binary already installed at /usr/bin/node. What is the recommended way to remove this so I can add the new binary? I could manually delete it, but would an "apt-get" command work better?

Return to “Beginners”