有没有办法在远程服务器上安装 NodeRed 节点?
Is there a way to install a NodeRed node in a remote server?
我尝试使用 POST /nodes,因为文档说它支持节点所在的路径,https://nodered.org/docs/api/admin/methods/post/nodes。
但是 POST /nodes 仅在本地主机中的服务器为 运行 时才有效,有谁知道是否可以使用 http api?
在远程服务器中安装节点
这是我尝试过的 POST 的示例:
curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -i http://REMOTE_SERVER_HOSTNAME:1880/nodes --data '{"module": "/tmp/testRemoteInstall"}'
来自您指向的文档
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.
这意味着 module
参数必须是以下之一:
- 可从 npmjs.org
获得的 NodeJS 模块的名称
- NodeJS 模块本地实例的路径。 (此路径必须是机器 运行 Node-RED 的本地路径,否则 Node-RED 应该如何访问远程文件?)
你有2个选择,
- 将您要安装的模块发布到 npmjs(或另一个 NodeJS 存储库,并确保服务器上的 npm 已正确配置以从那里安装)
- 在将本地路径作为
module
的值传递之前,将节点的目录复制到与 Node-RED 相同的机器上
我尝试使用 POST /nodes,因为文档说它支持节点所在的路径,https://nodered.org/docs/api/admin/methods/post/nodes。 但是 POST /nodes 仅在本地主机中的服务器为 运行 时才有效,有谁知道是否可以使用 http api?
在远程服务器中安装节点这是我尝试过的 POST 的示例:
curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -i http://REMOTE_SERVER_HOSTNAME:1880/nodes --data '{"module": "/tmp/testRemoteInstall"}'
来自您指向的文档
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.
这意味着 module
参数必须是以下之一:
- 可从 npmjs.org 获得的 NodeJS 模块的名称
- NodeJS 模块本地实例的路径。 (此路径必须是机器 运行 Node-RED 的本地路径,否则 Node-RED 应该如何访问远程文件?)
你有2个选择,
- 将您要安装的模块发布到 npmjs(或另一个 NodeJS 存储库,并确保服务器上的 npm 已正确配置以从那里安装)
- 在将本地路径作为
module
的值传递之前,将节点的目录复制到与 Node-RED 相同的机器上