I recently installed Node-Red and got the Bean Nodes extension for my Mac. Although it was a straightforward process, it was a bit time consuming. For this reason I have created a bash script that you can run in the terminal! If you feel anyway uncomfortable about using a script from a website or just want to know what each command in the bash script does, there is also the 8 step method in this same article. In this short blog, I will list all the steps needed to get started with Node-Red and Bean Nodes that will be used in future projects on this blog!
Note: All commands below are meant to be typed into the terminal, after each line click enter to execute the command.Three Step Method
2. Press Command + Spacebar and type "terminal", then open the terminal. Once in terminal, navigate to where you placed the file called "node_red_bean_install.sh" (if you do not know how to navigate through the terminal take a second to read this).
3. Once in that directory type
./node_red_bean_install.sh into the terminal and execute the command (hit enter). **NOTE: if this command gives you an error like this "-bash: ./node_red_bean_install.sh: Permission denied", type command chmod +x node_red_bean_install.sh into terminal and then retry this
./node_red_bean_install.sh again. It should now be installing and working hard! Just follow the prompts for admin passwords; when you are done, restart your computer.
That's it! When your computer opens, start up a terminal window and type
node-red. Now go to your favourite browser and go to http://localhost:1880. You should see the Bean Nodes in the left side menu (as shown in picture below).
1. If you have not already done so, install HomeBrew. It is like
but for Mac. It allows you to install apps and packages fairly easily, and the best part is it will also install all of the dependencies as well! I have used to it many times for my schooling as well as my own projects. To install HomeBrew open up a terminal window (hit Command + Spacebar and type terminal) and copy and paste this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once you have pasted it into the terminal click enter.
2. Now that you have HomeBrew, type
brew install npm into the terminal and hit enter. This will install the Node Package Manager that we will use for downloading the next components.
sudo npm install -g --unsafe-perm node-red into the terminal, this will install Node-Red. You can now run Node-Red on your computer by typing node-red into the terminal (to kill the process afterward press Ctrl + C).
4. The Bean Nodes depends on a library called Noble, type
npm install noble into the terminal to download this library.
5. Finally, type
mkdir -p ~/.node-red/node_modules into the terminal, followed by typing
npm install --prefix ~/.node-red node-red-contrib-bean into the terminal.
6. Now restart your computer.
7. Once your computer has opened, go to the terminal and type in node-red. Go to your favourite browser and go to http://localhost:1880
8. Now you should be able to see the Node-Red user interface; on the left side panel you should be able to see the LightBlue Bean elements such as acceleration, read/write scratch, etc. You have completed this tutorial!
I hope you enjoyed this quick tutorial on installing Node-Red with Bean Nodes. If you would like a tutorial on using Node-Red components I suggest Node-Red's first flow tutorial or watching this video on learning Node-Red in under 5 mins. and of course Punch Through's documentation on Bean Nodes. If you have any questions, comments or future suggestions please leave them in the comment section below!