Installing newer version of NodeJS on Pi 3
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.
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: 13
- Joined: Fri Mar 18, 2016 9:24 pm
Re: Installing newer version of NodeJS on Pi 3
Code: Select all
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout v5.9.0
Code: Select all
source ~/.nvm/nvm.sh
Re: Installing newer version of NodeJS on Pi 3
Thank you, but I still get "v0.10.29" when I run "node -v".
Am I missing something?
Am I missing something?
Re: Installing newer version of NodeJS on Pi 3
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: 13
- Joined: Fri Mar 18, 2016 9:24 pm
Re: Installing newer version of NodeJS on Pi 3
try runningericp wrote:Thank you, but I still get "v0.10.29" when I run "node -v".
Am I missing something?
Code: Select all
apt-get remove --purge node* npm*
-
- Posts: 13
- Joined: Fri Mar 18, 2016 9:24 pm
Re: Installing newer version of NodeJS on Pi 3
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 

Re: Installing newer version of NodeJS on Pi 3
Thank you asandford that worked for me.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
Re: Installing newer version of NodeJS on Pi 3
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
Re: Installing newer version of NodeJS on Pi 3
i just install on my new RPI 3
may i add here a question?
for MONGO i still do the
( what gives a MongoDB shell version: 2.4.10 ) and then a
what gives a MongoDB shell version: 3.0.9
anybody knows a better way / to a newer version???
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
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
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
anybody knows a better way / to a newer version???
-
- Posts: 10
- Joined: Fri Nov 28, 2014 12:44 am
Re: Installing newer version of NodeJS on Pi 3
To Install Latest version of NodeJs and the node-install utility to switch versions:
This works with EVERY raspberry pi as well as Beaglebone.
Make sure you check out the source code:
https://github.com/audstanley/NodeJs-Raspberry-Pi
Code: Select all
wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash
node -v
This works with EVERY raspberry pi as well as Beaglebone.
Make sure you check out the source code:
https://github.com/audstanley/NodeJs-Raspberry-Pi
Last edited by audstanley on Fri Jul 13, 2018 8:49 pm, edited 3 times in total.
-
- Posts: 1
- Joined: Fri May 26, 2017 1:50 pm
Re: Installing newer version of NodeJS on Pi 3
This is awesome, thanks so much for sharing your script. This seemed to work fine for me - I have node v7.10.0 up and running properly.
Thanks again!
Thanks again!
Re: Installing newer version of NodeJS on Pi 3
The best way I have found to install node.js is to use the Node Version Manager, nvm, as mentioned above.
Get and install nvm:
Use nvm to download and install the latest node.js version:
Job done.
Except, read the instructions for nvm here: https://github.com/creationix/nvm/blob/ ... all-script
When you want to upgrade node to a newer version, or downgrade sometimes, nvm can do that very easily.
Get and install nvm:
Code: Select all
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
Code: Select all
nvm install node
Except, read the instructions for nvm here: https://github.com/creationix/nvm/blob/ ... all-script
When you want to upgrade node to a newer version, or downgrade sometimes, nvm can do that very easily.
Slava Ukrayini.
Re: Installing newer version of NodeJS on Pi 3
@Heater, is node-red still running?
Re: Installing newer version of NodeJS on Pi 3
KLL,
If you mean, "does installing node.js with nvm break node-red?" then I'm fairly confident it will not. nvm does not actually install anything to your "system", it puts everything in your user directory and arranges symlinks to the version of node you ask for.
I guessing though.
I'm not sure I understand your question. I never use node-red, neat though it is....is node-red still running?
If you mean, "does installing node.js with nvm break node-red?" then I'm fairly confident it will not. nvm does not actually install anything to your "system", it puts everything in your user directory and arranges symlinks to the version of node you ask for.
I guessing though.
Slava Ukrayini.
Re: Installing newer version of NodeJS on Pi 3
pls test and confirm, i read "best methods" already at a other post and then had to reinstall raspbian
Re: Installing newer version of NodeJS on Pi 3
KLL,
Sorry, no can do, I'm travelling, no Pi to hand till I get home in a month or so..
If you have something that works then stick with it.
I'm not sure why you had to re-install raspbian just to get node.js and node-red working again. Removing and re-installing those packages should have done the trick.
Sorry, no can do, I'm travelling, no Pi to hand till I get home in a month or so..
If you have something that works then stick with it.
I'm not sure why you had to re-install raspbian just to get node.js and node-red working again. Removing and re-installing those packages should have done the trick.
Slava Ukrayini.
Re: Installing newer version of NodeJS on Pi 3
ok, i checked, node red still running ( sorry i doubted you )
Code: Select all
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
? open new terminal?
pi@RPI0:~ $ nvm current
system
pi@RPI0:~ $ nvm --version
0.33.2
pi@RPI0:~ $ npm -v
bash: npm: command not found
pi@RPI0:~ $ node -v
v0.10.29
nvm install node
pi@RPI0:~ $ nvm --version
0.33.2
pi@RPI0:~ $ npm -v
5.0.0
pi@RPI0:~ $ node -v
v8.0.0
Re: Installing newer version of NodeJS on Pi 3
Great stuff.
I'd be inclined to remove that ancient node v0.10.29 just to avoid any confusion in the future.
$ sudo apt-get remove nodejs
Or what ever the Raspbian node.js packages is called.
I'd be inclined to remove that ancient node v0.10.29 just to avoid any confusion in the future.
$ sudo apt-get remove nodejs
Or what ever the Raspbian node.js packages is called.
Slava Ukrayini.
Re: Installing newer version of NodeJS on Pi 3
I posted over a year ago:Heater wrote:Great stuff.
I'd be inclined to remove that ancient node v0.10.29 just to avoid any confusion in the future.
$ sudo apt-get remove nodejs
Or what ever the Raspbian node.js packages is called.
Code: Select all
apt-get remove nodejs nodejs-legacy -y
There is a script that will update nodejs, NR and npm (for NR):
Code: Select all
root@weatherpi:~# update-nodejs-and-nodered
Root user detected. Typically install as a normal user. No need for sudo.
Are you really sure you want to install as root ? (y/N) ? y
This script will remove any pre-installed versions of node.js and Node-RED
and replace them with node.js 6.x LTS (boron) and the latest Node-RED from Npm.
To do this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
Doing this may also be 'a bad thing' if you have installed lots of extra nodes.
Especially if they have any native binary component. Some nodes in your
~/.node-red directory will probably need to be re-installed afterwards, some
may need you to run npm update, and some may require you to run npm rebuild.
Are you really sure you want to do this ? (y/N) ? y
Running for user root at /root
This can take 20-30 minutes on a Pi 1 - please wait.
Stop Node-RED ✔
Remove old version of Node-RED ✔
Remove old version of node.js -
Update node.js LTS ✔ Node v6.10.3 Npm 3.10.10
Clean npm cache ✔
Install Node-RED core ✔ 0.16.2
Install extra nodes ✔
Install serialport node ✔
Npm rebuild existing nodes ✔
Add menu shortcut ✔
Update systemd script ✔
Update update script ✔
Any errors will be logged to /var/log/nodered-install.log
Re: Installing newer version of NodeJS on Pi 3
thanks, also works perfect without sudo..asandford wrote:There is a script that will update nodejs, NR and npm (for NR):Code: Select all
update-nodejs-and-nodered
see file:pi@RPI0:/ $ nodejs -v
v6.10.3
pi@RPI0:/ $ npm -v
3.10.10
Code: Select all
cat /usr/bin/update-nodejs-and-nodered
Re: Installing newer version of NodeJS on Pi 3
Old habit, Unix admin from 2000, I do everything as root.KLL wrote:
thanks, also works perfect without sudo..
Re: Installing newer version of NodeJS on Pi 3
Why not just:
$ npm install -g node-red
or
$ npm install node-red
As intended?
Same for installing node-serial port and other modules.
$ npm install -g node-red
or
$ npm install node-red
As intended?
Same for installing node-serial port and other modules.
Slava Ukrayini.
Re: Installing newer version of NodeJS on Pi 3
The devs at Node-Red suggest using the script they supplied to upgrade, so I guess that I am using what is intended to be used. Have a look hereHeater wrote:Why not just:
$ npm install -g node-red
or
$ npm install node-red
As intended?
Same for installing node-serial port and other modules.
To upgrade, run the following command as your normal user (typically pi):
update-nodejs-and-nodered
Note - If the serialport nodes do not appear when you restart, please re-run the update command. If the update command does not run or is not found then use the bash command from above.