Installing extra Nodes

Node-Red comes with an excellent set of basic nodes within its palette however there are more out there and there is certainly nothing stopping you from writing your own!

Some of the nodes also have dependencies on external libraries and without these being installed will not function correctly. As an example for the twitter node to work correctly you need OAuth which allows you to authenticate with twitter.com to be able to send/receive tweets.

You may remember from the initial starting of node red we saw a list of these missing dependencies as shown below.
Download: file
25 Jan 11:31:45 - [red] Loading palette nodes
25 Jan 11:31:45 - ------------------------------------------
25 Jan 11:31:54 - [61-email.js] Error: Cannot find module '/home/pi/node-red/../emailkeys.js'
25 Jan 11:31:54 - [imap] : Failed to load Email credentials
25 Jan 11:31:55 - [66-mongodb.js] Error: Cannot find module 'mongodb'
25 Jan 11:31:57 - [74-swearfilter.js] Error: Cannot find module 'badwords'
25 Jan 11:31:57 - [72-wordpos.js] Error: Cannot find module 'wordpos'
25 Jan 11:31:57 - [78-ledborg.js] Warning: PiBorg hardware : LedBorg not found
25 Jan 11:31:57 - [76-blinkstick.js] Error: Cannot find module 'blinkstick'
25 Jan 11:31:57 - [77-blink1.js] Error: Cannot find module 'node-blink1'
25 Jan 11:31:57 - [78-digiRGB.js] Error: Cannot find module 'node-hid'
25 Jan 11:31:57 - [103-hue_discover.js] Error: Cannot find module 'node-hue-api'
25 Jan 11:31:57 - [104-hue_manage.js] Error: Cannot find module 'node-hue-api'
25 Jan 11:31:57 - [103-hue_discover.js] Error: Cannot find module 'node-hue-api'
25 Jan 11:31:58 - [104-hue_manage.js] Error: Cannot find module 'node-hue-api'
25 Jan 11:31:58 - [101-scanBLE.js] Error: Cannot find module 'noble'
25 Jan 11:31:58 - [79-sensorTag.js] Error: Cannot find module 'sensortag'
25 Jan 11:31:58 - [60-wemo.js] Error: Cannot find module 'wemo'
25 Jan 11:31:58 - [26-rawserial.js] Advise: Only really needed for Windows boxes without serialport npm module installed.
25 Jan 11:31:58 - [39-wol.js] Error: Cannot find module 'wake_on_lan'
25 Jan 11:31:58 - [69-mpd.js] Error: Cannot find module 'komponist'
25 Jan 11:31:58 - [57-notify.js] Error: Cannot find module 'growl'
25 Jan 11:31:58 - [57-prowl.js] Error: Cannot find module 'node-prowl'
25 Jan 11:31:58 - [57-pushbullet.js] Error: Cannot find module 'pushbullet'
25 Jan 11:32:00 - [56-twilio.js] Error: Failed to load Twilio credentials
25 Jan 11:32:00 - [92-xmpp.js] Error: Cannot find module 'simple-xmpp'
You may have more in your list as I have installed quite a few but the main point is that the "Cannot find module 'X'" is Node-Red telling us that we have a missing dependency.

Luckily it is very easy to install these and as an example if we wanted to install the swear filter node, which filters out bad words we just simply have to carry out the following steps.

First stop node red if it is running using the management script from earlier on in the tutorial.
Download: file
sudo service node_red stop
Then ensure you are within your Node-Red directory. If you have been following this tutorial yours will match mine as shown below.
Download: file
cd ~/node-red/
Next we use node package manager to install the dependency for us, which is named exactly as the "Cannot find module" statement told us.
Download: file
sudo npm install badwords
You will then see the package being installed.
Download: file
npm http GET https://registry.npmjs.org/badwords
npm http 200 https://registry.npmjs.org/badwords
npm http GET https://registry.npmjs.org/badwords/-/badwords-0.0.3.tgz
npm http 200 https://registry.npmjs.org/badwords/-/badwords-0.0.3.tgz
[email protected] node_modules/badwords
Once that has completed we can start Node-Red up again and you will be able to now use the Swear Filter node.
Download: file
sudo service node_red start
To ease the pain of you having to go through the whole process each time for each module I have constructed a list of the common modules that you will need to install.

Simply stop Node-Red and follow the process as we did for the bad words example but replace sudo npm install badwords with the following line.
Download: file
sudo npm install ntwitter oauth sentiment wordpos xml2js firmata fs.notify serialport feedparser pushbullet irc simple-xmpp redis mongodb
This guide was first published on Jan 25, 2014. It was last updated on Jan 25, 2014. This page (Installing extra Nodes) was last updated on Oct 13, 2019.