bbartling
bbartling

Reputation: 3502

install a node red module from a git repo

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

Looks like this: enter image description here

How do I install it, so I can pull the module out of the node red pallet?

Upvotes: 0

Views: 2133

Answers (2)

hardillb
hardillb

Reputation: 59801

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

Upvotes: 1

knolleary
knolleary

Reputation: 10117

The repository you link to includes a readme with instructions for how to install it. Nowhere does it say to copy anything into the node_modules directory.

Step one says:

Copy all files from volttron/examples/NodeRed to your .node-red/nodes directory.

Upvotes: 1

Related Questions