Git Product home page Git Product logo

nodejs-raspberry-pi's Introduction

stars forks source-code issues concurrency

go-report-card

Node Pi Gif

NodeJs-Raspberry-Pi

Latest NodeJS Install:

This is a simple shell script that will install the latest version of NodeJs available to your raspberry pi on every all types of raspberry pis (zero|1|2|3|4) This also happens to work on other ARM6, ARM7, ARM64 and x86_64 linux computers.

I have yet to confirm, but there may be an issue on Jessy and Stretch, if you are running the older pi OS

First, you will need to install the latest version of NodeJs on your pi by going into your Raspberry Pi zero|1|2|3's terminal, and running:

wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash;
node -v;

Specific Version of NodeJs:

Once you have run the initial installer, you can install different versions at any time by opening a new terminal and typing:

sudo node-install -v 4.9.1; # if you want to be specific
sudo node-install -v 4;
# then you will get prompted with which 
# specific version of 4 you wish to install
sudo node-install -v 5;
# then you will get prompted with which 
# specific version of 5 you wish to install
sudo node-install -v 6;
# then you will get prompted with which 
# specific version of 6 you wish to install
sudo node-install -v 7;
# then you will get prompted with which 
# specific version of 7 you wish to install
sudo node-install -v 8;
# then you will get prompted with which 
# specific version of 8 you wish to install
sudo node-install -v 9;
# then you will get prompted with which 
# specific version of 9 you wish to install
sudo node-install -v 10;
# then you will get prompted with which 
# specific version of 10 you wish to install
sudo node-install -v 11;
# then you will get prompted with which 
# specific version of 11 you wish to install
sudo node-install -v 12;
# then you will get prompted with which 
# specific version of 12 you wish to install
sudo node-install -v 13;
# then you will get prompted with which 
# specific version of 13 you wish to install
sudo node-install -v 14;
# then you will get prompted with which 
# specific version of 14 you wish to install
sudo node-install -v 15;
# then you will get prompted with which 
# specific version of 15 you wish to install
sudo node-install -v 16;
# then you will get prompted with which 
# specific version of 16 you wish to install
sudo node-install -v 17;
# then you will get prompted with which 
# specific version of 17 you wish to install
sudo node-install -v 18;
# then you will get prompted with which 
# specific version of 18 you wish to install
sudo node-install -v 19;
# then you will get prompted with which 
# specific version of 19 you wish to install
sudo node-install -v 20;
# then you will get prompted with which 
# specific version of 20 you wish to install
sudo node-install -v 21;
# then you will get prompted with which 
# specific version of 21 you wish to install

Please note that this will work for EVERY raspberry pi running buster or greater.

Buy Me a Coffee at ko-fi.com

or stop by at my blog: audstanley.com

Always keep NodeJs up to date:

If you want to keep your Raspberry Pi up to date with the Latest Version of Node at all times, edit your /etc/crontab file:

sudo nano /etc/crontab

Add this line to the bottom of your crontab:

0 22 1,7,14,21 * * root node-install -a;

This will update your raspberry pi with the latest version of NodeJs on days 1st, 7st, 14th, and 21st of every month at 10:00pm.

Thank you so much:

Hansie

Casper

Ladvien

Phil

Shane

Dan

Bob

Anon

Jeff

Thank you (bug catchers)

JadeEllis

Kryten0807

fivdi for reporting that there are newer binaries of Node.

Traffic:

Thank you for checking out the project, and using the node-install utility. This github project (as of 2019), reaches about an average of 10,000 people every year.

Development

If you would like to develop for this project, Just install VSCode with Docker as a Dependency (follow this guide), and the VSCode extensions Remote - Containers and Remote - Development then git clone the project, open the project in VSCode, Ctrl Shift P, "Open Folder in Container" then ./build.sh to build the binaries for all the archetectures. You will need WSL2 if you are on windows.

Stargazers

Stargazers over time

nodejs-raspberry-pi's People

Contributors

audstanley avatar chessmango avatar facastagnini avatar gahujipo avatar hsz avatar jadedblueeyes avatar ricktonoli avatar steji avatar timmalich avatar xp1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejs-raspberry-pi's Issues

Supports choosing NodeJS version?

Hi, first of all, i would like to thank you for your great script! 👍

I am just curious do you think it can support choosing a specific version of NodeJS that's being provided by user?

Like, for now i am getting version9 by default, i would like to choose version8 of NodeJS instead.

Not working in Rasbian Buster

Receiving the following error on running the install script.

./Install-Node.sh: line 13: syntax error near unexpected token else' ./Install-Node.sh: line 13: else /bin/node-install -a;'

runs and installs 10.6.0, fails when running sudo node-install -v 8 in bash

Traceback (most recent call last):
  File "/bin/node-install", line 241, in <module>
    installDependencies()
  File "/bin/node-install", line 68, in installDependencies
    o, e = Popen(['pip', 'install', 'requests'], stdout=PIPE, stderr=PIPE).communicate()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

it seems it's failing to create/access a directory it needs.
edit: it's a error with pip. as @Kryten0807 said:

The problem is that the "Installing Python Pip..." step failed silently. The node-install script attempts to install python2-pip, but in Raspbian Stretch lite that package is called python-pip.

the full code is:


pi@node-pi-001:~ $ sudo bash
root@node-pi-001:/home/pi# sudo wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | bash
--2018-07-13 15:54:28--  https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.16.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.16.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1689 (1.6K) [text/plain]
Saving to: ‘STDOUT’

-                                          100%[========================================================================================>]   1.65K  --.-KB/s    in 0.003s

2018-07-13 15:54:30 (481 KB/s) - written to stdout [1689/1689]

--2018-07-13 15:54:32--  https://nodejs.org/dist/latest-v10.x/node-v10.6.0-linux-armv6l.tar.gz
Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2400:cb00:2048:1::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17284155 (16M) [application/gzip]
Saving to: ‘node-v10.6.0-linux-armv6l.tar.gz’

node-v10.6.0-linux-armv6l.tar.gz           100%[========================================================================================>]  16.48M  3.45MB/s    in 5.6s

2018-07-13 15:54:38 (2.94 MB/s) - ‘node-v10.6.0-linux-armv6l.tar.gz’ saved [17284155/17284155]

update-alternatives: using /opt/nodejs/bin/node to provide /usr/bin/node (node) in auto mode
update-alternatives: using /opt/nodejs/bin/npm to provide /usr/bin/npm (npm) in auto mode
rm: cannot remove 'node-install': No such file or directory
--2018-07-13 15:55:10--  https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/node-install
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.16.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.16.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10826 (11K) [text/plain]
Saving to: ‘node-install’

node-install                               100%[========================================================================================>]  10.57K  --.-KB/s    in 0.004s

2018-07-13 15:55:10 (2.44 MB/s) - ‘node-install’ saved [10826/10826]

root@node-pi-001:/home/pi# sudo node-install -v 8
                                  ;
                                  +++
                                  +++
                                  +++
   ''++''       :;;',        ,+++;+++    ''++''
:++++++++++: ;;;;;;;''''  '++++'+++++ :++++++++++:
+++.    .++' ';;;;;;;;''  +++     +++ '++. '' .+++
+++.    .++' '';;;;;;;;'  +++     +++ '++. '' ''
+++.    .++' ''';;;;;;;;  '++++'+++++ :+++++,
:          ,   '';;;,        ,+++;       ''++'.
                   #+''#';+''+'
                   ';;;+#'+;;'
                    .###''@#@
                    '@++@@'+#@
                  :'@'''@'''''+
                   ##@@'''#@+#@
                   .'''#''@''#
                     '#'''#'


Updating Repositories...
Need to install some dependencies, this may take a few minutes...
Installing Python Pip...
Installing Python Requests Library...
Traceback (most recent call last):
  File "/bin/node-install", line 241, in <module>
    installDependencies()
  File "/bin/node-install", line 68, in installDependencies
    o, e = Popen(['pip', 'install', 'requests'], stdout=PIPE, stderr=PIPE).communicate()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
root@node-pi-001:/home/pi# exit

Node.js v12 & v13 ARMv6 binaries for the Raspberry Pi Zero or 1

In the readme is says:

Please note that there is currently no arm6 build for node version 12 or 13, so you will get prompted to install the latest build of Node v11 if you are installing on a pi zero, or pi 1

Unofficial Node.js v12 & v13 ARMv6 binaries for the Raspberry Pi Zero or 1 are now available at https://unofficial-builds.nodejs.org/download/.

The binaries are provided by the Node.js unofficial-builds project.

NodeJs-Raspberry-Pi could be extended to install these binaries when appropriate. Alternatively, a note could be added to the readme to let people know where the binaries can be found.

Possible errors

First of all, I want to say thanks for this script. You saved me much hair pulling.

I ran into a couple of issues with the node install bits (I didn't need mongo, so I just manually ran the node install).

First was this line:

sudo mv node-v5.3.0-linux-armv7l.tar.gz/ /opt/nodejs/;

I'm pretty sure you meant this:

sudo mv node-v5.3.0-linux-armv7l/ /opt/nodejs/;

Second were the symlinks.

It didn't work for me until I added this link:

sudo ln -s /opt/nodejs/bin/node /usr/local/bin/node

Other than that it worked like a charm, and I thank you once more!

Fails on RPi 3 B+ with fresh install of Raspbian Stretch Lite

Here's what it looks like:

Updating Repositories...
Need to install some dependencies, this may take a few minutes...
Installing Python Pip...
Installing Python Requests Library...
Traceback (most recent call last):
  File "/bin/node-install", line 241, in <module>
    installDependencies()
  File "/bin/node-install", line 68, in installDependencies
    o, e = Popen(['pip', 'install', 'requests'], stdout=PIPE, stderr=PIPE).communicate()
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

The problem is that the "Installing Python Pip..." step failed silently. The node-install script attempts to install python2-pip, but in Raspbian Stretch lite that package is called python-pip.

404 Not Found

Tried your script but I'm getting a 404.

--2019-04-09 23:02:20-- https://nodejs.org/dist/latest-v10.x/node-v11.13.0-linux-armv6l.tar.gz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2606:4700:10::6814:172e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-04-09 23:02:21 ERROR 404: Not Found.

tar (child): node-v11.13.0-linux-armv6l.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
rm: cannot remove 'node-v11.13.0-linux-armv6l.tar.gz': No such file or directory
mv: cannot stat '/root/tempNode/node-v11.13.0-linux-armv6l/': No such file or directory
update-alternatives: error: alternative path /opt/nodejs/bin/node doesn't exist
update-alternatives: error: alternative path /opt/nodejs/bin/npm doesn't exist
--2019-04-09 23:02:21-- https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/node-install
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.184.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.184.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10841 (11K) [text/plain]
Saving to: ‘node-install’

-bash: /usr/bin/node: No such file or directory

I am trying to install NodeJs on a freshly setup Raspberry Pi 1 B running debian bullseye. The NodeJs setup runs fine and ends with good to go however node -v, npm and any other node related command results in -bash: /usr/bin/node: No such file or directory. The file does exist, so I am unsure what the problem might be.

# ls -la /usr/bin/node
-rwxr-xr-x 1 root root 72828244 Oct 29 11:13 /usr/bin/node

ImportError: No module named requests

I get following error while installing:

`pi@raspberrypi:~ $ wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash;
--2020-06-09 16:26:39-- https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 405 [text/plain]
Saving to: ‘STDOUT’

  •                                                                           100%[======================================================================================================================================================================================================>]     405  --.-KB/s   in 0s
    

2020-06-09 16:26:39 (2.42 MB/s) - written to stdout [405/405]

rm: cannot remove ‘node-install’: No such file or directory
--2020-06-09 16:26:39-- https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/node-install
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10913 (11K) [text/plain]
Saving to: ‘node-install’

node-install 100%[======================================================================================================================================================================================================>] 10.66K --.-KB/s in 0.002s

2020-06-09 16:26:39 (4.28 MB/s) - ‘node-install’ saved [10913/10913]

                              ;
                              +++
                              +++
                              +++

''++'' :;;', ,+++;+++ ''++''
:++++++++++: ;;;;;;;'''' '++++'+++++ :++++++++++:
+++. .++' ';;;;;;;;'' +++ +++ '++. '' .+++
+++. .++' '';;;;;;;;' +++ +++ '++. '' ''
+++. .++' ''';;;;;;;; '++++'+++++ :+++++,
: , '';;;, ,+++; ''++'.
#+''#';+''+'
';;;+#'+;;'
.###''@#@
'@++@@'+#@
:'@'''@'''''+
##@@'''#@+#@
.'''#''@''#
'#'''#'

Installing Python Requests Library...
Traceback (most recent call last):
File "/bin/node-install", line 249, in
installLatestVersion()
File "/bin/node-install", line 223, in installLatestVersion
import requests
ImportError: No module named requests
`

node-install does not install node(

pi@rpi:~ $ sudo node-install -v 12;
;
+++
+++
+++
''++'' :;;', ,+++;+++ ''++''
:++++++++++: ;;;;;;;'''' '++++'+++++ :++++++++++:
+++. .++' ';;;;;;;;'' +++ +++ '++. '' .+++
+++. .++' '';;;;;;;;' +++ +++ '++. '' ''
+++. .++' ''';;;;;;;; '++++'+++++ :+++++,
: , '';;;, ,+++; ''++'.
#+''#';+''+'
';;;+#'+;;'
.###''@#@
'@++@@'+#@
:'@'''@'''''+
##@@'''#@+#@
.'''#''@''#
'#'''#'

Select from list to install specific version of Node 12.X.X:

  1. 12.5.0
  2. 12.4.0
  3. 12.3.1
  4. 12.3.0
  5. 12.2.0
  6. 12.1.0
  7. 12.0.0
    Selection: 1
    Creating, and Changing into directory:/tempNode-12.5.0
    Downloading: https://nodejs.org/dist/v12.5.0/node-v12.5.0-linux-armv6l.tar.gz
    Extracting: node-v12.5.0-linux-armv6l.tar.gz
    Installation is Complete.
    pi@rpi:~ $ nodejs -v
    -bash: nodejs: command not found

why it does not work (

Error on a Rasperry Pi Jessie OS (ARM)

After the install and when I run "node -v" I get the error below.

node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version CXXABI_1.3.9' not found (required by node) node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version GLIBCXX_3.4.21' not found (required by node)

I did a "strings /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIB" can get the following output.
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBC_2.4
GLIBC_2.18

No "GLIBCXX_3.4.21"

Any assistance would be appreciated. I also tried downgrading a few versions and get the same result.

[EDIT]
After some searching on the net, I found that the best approach is to either upgrade Jessie to Strech on Raspiberry Pi or copy libstdc++.so.6 from Strech to Jessie. Going with upgrade, will post results.

First install RPI 2

./Install-Node.sh: line 26: /usr/sbin/node: No such file or directory
ln: missing file operand
Try 'ln --help' for more information.
module.js:472
throw err;
^

Error: Cannot find module '/usr/local/bin/node'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:418:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:533:3
./Install-Node.sh: line 28: /usr/bin/npm: No such file or directory
ln: missing file operand
Try 'ln --help' for more information.

Installation hangs up my Pi 3 with Stretch

When I run the "wget" line, a lot happens in a hurry, then the cursor hangs up, and I have to Ctrl+C to get out:

wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash
--2018-07-24 18:43:24--  https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh
[sudo] password for butch: Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.4.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.4.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1689 (1.6K) [text/plain]
Saving to: 'STDOUT'

-                           100%[===========================================>]   1.65K  --.-KB/s    in 0s      

2018-07-24 18:43:25 (28.3 MB/s) - written to stdout [1689/1689]

I've done it twice, same result. After Ctrl+C, I try to run "node -v", and get:
-bash: node: command not found

Did I miss a step?

Node tarball 404

From log:

--2016-01-15 01:56:26-- https://nodejs.org/dist/latest-v5.x/node-v5.3.0-linux-armv7l.tar.gz
Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46
Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-01-15 01:56:34 ERROR 404: Not Found.

Pretty sure this is because 5.3 is no longer latest.
Change to latest (5.4.1 at the moment) fixes this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.