Installing newer version of NodeJS on Pi 3


10 posts
by ericp » Fri Mar 18, 2016 5:40 pm
How can I install a newer version of Node Js on the Raspberry Pi 3?
node version: v0.10.29
npm version: 1.4.21
I have Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie
Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux


Thank you for any help.
Posts: 3
Joined: Fri Mar 18, 2016 5:35 pm
by LewisCowles1986 » Fri Mar 18, 2016 9:28 pm
Code: Select all
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout v5.9.0


Then whenever you want to use node run
Code: Select all
source ~/.nvm/nvm.sh


or add that line to your `.bashrc` or `.profile`
Posts: 3
Joined: Fri Mar 18, 2016 9:24 pm
by ericp » Fri Mar 18, 2016 11:23 pm
Thank you, but I still get "v0.10.29" when I run "node -v".
Am I missing something?
Posts: 3
Joined: Fri Mar 18, 2016 5:35 pm
by asandford » Sat Mar 19, 2016 12:03 am
ericp wrote:How can I install a newer version of Node Js on the Raspberry Pi 3?
node version: v0.10.29
npm version: 1.4.21
I have Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie
Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux


Thank you for any help.

Code: Select all
pi@raspberrypi:~ $  node -v
v0.10.29
pi@raspberrypi:~ $  sudo su -
root@raspberrypi:~ # apt-get remove nodered -y
root@raspberrypi:~ # apt-get remove nodejs nodejs-legacy -y
root@raspberrypi:~ # apt-get remove npm  -y # if you installed npm
root@raspberrypi:~ # curl -sL https://deb.nodesource.com/setup_5.x | sudo bash -
root@raspberrypi:~# apt-get install nodejs -y
root@raspberrypi:~# node -v
v5.9.0
root@raspberrypi:~# npm -v
3.7.3
Posts: 1437
Joined: Mon Dec 31, 2012 12:54 pm
Location: Ealing
by LewisCowles1986 » Sat Mar 19, 2016 12:47 am
ericp wrote:Thank you, but I still get "v0.10.29" when I run "node -v".
Am I missing something?


try running
Code: Select all
apt-get remove --purge node* npm*
Posts: 3
Joined: Fri Mar 18, 2016 9:24 pm
by LewisCowles1986 » Sat Mar 19, 2016 12:52 am
The reason to apt-get remove is because you may have a version installed via package manager. Otherwise I'd suggest reading the documentation on node version manager (nvm) as it might be you did not run the command exactly as it was typed. In any case you should be up and running soon ;)
Posts: 3
Joined: Fri Mar 18, 2016 9:24 pm
by ericp » Sun Mar 20, 2016 1:56 pm
asandford wrote:
Code: Select all
pi@raspberrypi:~ $  node -v
v0.10.29
pi@raspberrypi:~ $  sudo su -
root@raspberrypi:~ # apt-get remove nodered -y
root@raspberrypi:~ # apt-get remove nodejs nodejs-legacy -y
root@raspberrypi:~ # apt-get remove npm  -y # if you installed npm
root@raspberrypi:~ # curl -sL https://deb.nodesource.com/setup_5.x | sudo bash -
root@raspberrypi:~# apt-get install nodejs -y
root@raspberrypi:~# node -v
v5.9.0
root@raspberrypi:~# npm -v
3.7.3


Thank you asandford that worked for me.
Posts: 3
Joined: Fri Mar 18, 2016 5:35 pm
by surbyte » Thu May 05, 2016 6:49 pm
The right sequence for me

Code: Select all
pi@raspberrypi:~ $  node -v
v0.10.29
pi@raspberrypi:~ $  sudo su -
root@raspberrypi:~ # apt-get remove --purge node* npm*
root@raspberrypi:~ # curl -sL https://deb.nodesource.com/setup_5.x | sudo bash -
root@raspberrypi:~# apt-get install nodejs -y
root@raspberrypi:~# node -v
v5.11.0
root@raspberrypi:~# npm -v
3.8.6
Posts: 1
Joined: Fri Dec 25, 2015 3:47 pm
by KLL » Fri May 06, 2016 1:52 pm
i just install on my new RPI 3
Code: Select all
mkdir node
cd node
wget https://nodejs.org/dist/latest/node-v6.1.0-linux-armv7l.tar.gz
tar -xvf node-v6.1.0-linux-armv7l.tar.gz
cd node-v6.1.0-linux-armv7l
sudo cp -R * /usr/local/

sudo reboot
node -v
v6.1.0
npm -v
3.8.6


may i add here a question?
for MONGO i still do the
Code: Select all
wget https://github.com/tjanson/mongodb-armhf-deb/releases/download/v2.1.1-1/mongodb_2.1.1_armhf.deb
sudo dpkg -i mongodb_2.1.1_armhf.deb   //error
sudo apt-get -f install                // does the libboost thing
sudo dpkg -i mongodb_2.1.1_armhf.deb

( what gives a MongoDB shell version: 2.4.10 ) and then a
Code: Select all
wget http://andyfelong.com/downloads/core_mongodb.tar.gz
wget http://andyfelong.com/downloads/tools_mongodb.tar.gz
tar xvf core_mongodb.tar.gz
tar xvf tools_mongodb.tar.gz

sudo strip mongo*
sudo chown root:root mongo*
sudo chmod 755 mongo*
sudo service mongodb stop

sudo mv mongo* /usr/bin

what gives a MongoDB shell version: 3.0.9

anybody knows a better way / to a newer version???
Posts: 538
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
by audstanley » Tue Dec 27, 2016 9:08 pm
To Install Latest version of NodeJs 7.x:
Code: Select all
sudo apt-get install git && git clone https://github.com/audstanley/NodeJs-Raspberry-Pi-Arm7 && cd NodeJs-Raspberry-Pi-Arm7 && chmod +x Install-Node.sh && sudo ./Install-Node.sh;


This will also delete old versions of NodeJs, and you can re-run this to upgrade to the newest version of Node. This works an the Raspberry pi 2/3 running an ARM7. I'll update every integer version of Node, as they release new versions.
Posts: 7
Joined: Fri Nov 28, 2014 12:44 am