Search code examples
node.jsnode-red

Is there a way to install a NodeRed node in a remote server?


I have tried to use the POST /nodes since the documentation says it support the path where the node is located, https://nodered.org/docs/api/admin/methods/post/nodes. But the POST /nodes only works when the server is running in localhost, does anyone know if is possible install the node in a remote server using the http api?

Here is an example of the POST that I have tried:

curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -i http://REMOTE_SERVER_HOSTNAME:1880/nodes --data '{"module": "/tmp/testRemoteInstall"}'

Solution

  • From the doc you pointed to

    module:
    Either the name of the node module to install from the npm repository, or a full path to a directory containing the node module. Note: this api does not support the full range of module specifiers used by npm such as .tgz files or version qualifiers.

    This means that the module argument has to be one of the following:

    • The name of a NodeJS module available from npmjs.org
    • The path to a local instance of the NodeJS module. (This path must be local to the machine running Node-RED as how else is Node-RED supposed to access a remote file?)

    You have 2 choices,

    1. publish the module you want to install to npmjs (or another NodeJS repository and make sure the npm on the server is properly configured to install from there)
    2. copy the node's directory to the same machine as Node-RED before passing the local path as the value of module