member
Raspberry basics: Project 27a Raspberry PI Zero W board - How to install Node.js
of Acoptex.com in Raspberry Pi Zero W
Raspberry basics: Project 27a
Project name: Raspberry PI Zero W board - How to install Node.js
Tags: Raspberry, Raspberry PI Zero W board, vers 1.1, v 1.1, How to install Node.js, Node.js
Attachments: None
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. Raspberry PI Zero W board or full kit 1 pc
2. Micro SD card with NOOBS and SD card adapter 1 pc
3. Micro USB power supply (2 A 5V or 5V 3A) 1 pc
4. USB keyboard 1 pc
5. USB mouse 1 pc
6. TV or PC monitor 1 pc
7. HDMI cable 1 pc
8. T-Cobbler Breakout and GPIO Cable 1 pc
9. Micro USB 2.0 OTG Cable 1 pc
10. Mini HDMI to HDMI Adapter (HDMI to Mini HDMI Adapter) 1 pc
11. 4-Port USB 2.0 Hub 1 pc
General
We will learn how to install Node.js on Raspberry Pi.
From Wikipedia: "Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser".
Understanding the Raspberry PI Zero W board
You can read more about it here.
Signals and connections of the Raspberry PI Zero W board
Step by Step instruction
We recommend using a high-performance SD card for increased stability as well as plugging your device into an external display to see the default application booting up.
1. Setup and preparation
We assume that you have Raspbian OS installed on your Raspberry Pi Zero W board.
- Do wiring.
- Insert your micro SD card with Raspbian OS into the TF card slot on the Raspberry Pi Zero W board. It will only fit one way.
- Connect Raspberry PI Zero W board mini HDMI port to your TV or Monitor HDMI (DVI) port (use HDMI cable and mini HDMI to HDMI adapter and/or HDMI to DVI adapter).
- Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI/DVI, etc).
- Plug in micro USB 2.0 OTG Cable to USB data port of Pi Zero and 4-Port USB 2.0 Hub to micro USB 2.0 OTG Cable.
- Plug in your USB mouse and USB keyboard to 4-Port USB 2.0 Hub.
- If you intend to connect your Raspberry Pi Zero vers 1.2 or vers 1.3 to the internet, connect a WiFi dongle to one of the 4-Port USB 2.0 Hub ports.
- Connect Micro USB power supply to Raspberry PI Zero board micro USB input.
- The Raspberry PI desktop will start up.
- Open Terminal window and type the command: sudo apt-get update
- Then type the command: sudo apt-get upgrade -y
- Adding -y to the end of apt-get commands instructs the program to automatically answer yes to any questions rather than waiting for you to type Y or N.
2. Installing Node.js
- Go to the Terminal.
- The Raspberry Pi has ARM processor and depending on the Raspberry Pi model it can be ARMv6, ARMv7 or ARMv8. This 3 versions of ARM is supported by Node.js.
- Type the command to detect the version of ARM processor: uname -m
- Depending on response you will see which version of ARM processor you have (for example, we have ARMv6). Go to node.js website and check, do right click with mouse on the version of ARM that you need (for example, ARMv6) and choose Copy Link address.
- Download download the tar.gz file for that version by typing the command in Terminal: wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-armv6l.tar.xz
- So first you type wget then paste the link copied before and make sure the extension is .tar.gz.
- Extract the archive by using tar that is already installed with the system on your Raspberry Pi just type this command: tar -xzf node-v10.15.3-linux-armv6l.tar.xz Make sure you change the filename with the file that you have.
- We will add Node.js to the correct location /usr/local and expose it as globally available command - type this command: sudo cp -r node-v10.15.3-linux-armv6l/* /usr/local/
- The copied binaries are now exposed to your $PATH.
- We need to reboot our Raspberry PI. Type this command in the Terminal: sudo reboot
3. Checking the Node.js installation
- The Raspberry PI desktop will start up again. You can check that your Raspberry Pi has Node.js and npm installed by typing these commands: node -v
- npm -v or npm --version
- Congrats!! The Node.js and NPM have been successfully installed on your Raspberry Pi and working so you can start building your DIY projects with Node.js.
- In order to be safe with future updates, you will also have to install Git since NPM is heavily coupled with it. You may install Git by typing the command: sudo apt-get install git
Summary
We have learnt how to install Node.js on Raspberry Pi.
Libraries in use
- None
Script
- None
Other projects of Acoptex.com










jobs.viewed