First of all i made this guide using Raspberry Pi 3, however it should work with Raspberry Pi 2 too, but i have no idea if things here are working for Raspberry Pi 1 or Raspberry Pi Zero. If you tried to use this guide on Raspberry Pi 1 or Raspberry Pi Zero, let me know if its working or not by messaging me on Discord. Tresmos#2135
Installing Node.js on a Raspberry Pi
Connect your raspberry pi using PuTTY, or using VNC and type these commands in order to install Node.js:
for Node.js 8:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
for Node.js 9:
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
After everything is done, check if Node.js is installed correctly or not with these commands:
node -v
npm -v
it should give you an output like this:
pi@raspberrypi:~ $ node -v
v9.10.0
pi@raspberrypi:~ $ npm -v
5.6.0
This is an example if you want to watch it:
Uploading Bot Files to Raspberry Pi
Before uploading your bot files you need to export it first watching this video. (If you're using beta DO NOT use built in export feature because its still buggy. Please export it manually watching the video)
After that you have a couple options to upload your bot files to Raspberry Pi:
FileZilla
Download and install FileZilla using this link. Now before uploading bot files, we need to connect our Raspberry Pi. To do that we need to open Site Manager and add our Raspberry Pi:
Just click New Site
- Host = IP of Raspberry Pi
- Protocol = SFTP - SSH File Transfer Protocol (thats really important)
- Logon Type = Normal
- User = pi
- Password = Your SSH Password
After saving that and connecting, you can upload your bot files with just simple drag&drop to right side
VNC Viewer
First you need to activate VNC and connect to Raspberry Pi using this guide.
Then for transfer files click here at the top:
After that you'll see a window, click Send Files, go into your bot folder, and press Use Entire Folder:
as we can see it started to upload files to Raspberry Pi:
Running The Bot
There is two ways to run your bot:
with PuTTY
with VNC Connection
Running With PuTTY
- Connect to your Raspberry Pi using PuTTY
- cd into your bot folder (if your bot folder is in Desktop, type "cd Desktop/YourBotFolderName")
- and finally type "node bot.js" to run your bot.
Thats it!
In this way if you close PuTTY, your bot will stop working too.
Running With VNC Connection
- Connect to your Raspberry Pi using VNC Viewer
- Open your bot folder
- Press F4 to open terminal window in your project folder
- and type "node bot.js" to run your bot
Thats it!
In this way you can close VNC Viewer and your bot will still run, however if you close that terminal window bot will stop working.