for node red, how do you install a node?
I downloaded some code from github that is for node red and placed the contents in this directory:
~/.node-red/node_modules/volttron
How do I install it, so I can pull the module out of the node red pallet?
The instructions included in that directory say to place the files in the ~/.node-red/nodes/volttron
directory (you will need to make the nodes
dir) not ~/.node-red/node_modules/volttron
. But even then it won't work out of the box as it requires the python-shell
npm module to also be installed.
A slightly better approach will be to do the following:
Copy the files to ~/.node-red/node_modules/volttron
.
In order for Node-RED to locate the nodes in the node_modules
directory there must be a package.json
file. This also needs to include node-red
section listing the nodes.
The package.json
also needs to include the required pre-requisite modules in this case python-shell
As a short term work around you can create a package.json
in the ~/.node-red/node_modules/volttron
directory with the other files and containing the following:
{
"name" : "volttron",
"version" : "0.0.1",
"description" : "A sample node for node-red",
"dependencies": {
"python-shell": "^3.0.1"
},
"keywords": [ "node-red" ],
"node-red" : {
"nodes": {
"volttron": "volttron.js"
}
}
}
Then run npm install
while in the volttron directory. You will need to restart Node-RED for the node to be discovered