『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 1887|回复: 1

[教程系列] node-red2.2.0后action节点不可用的解决方案

[复制链接]

77

主题

1391

帖子

2万

积分

元老级技术达人

积分
24304
金钱
22873
HASS币
290
发表于 2022-2-1 21:18:57 | 显示全部楼层 |阅读模式
本帖最后由 dscao 于 2022-2-1 21:21 编辑

昨天升级了add on中的Node-RED 10.4.0 ,也就是node-red 2.2.0,结果之前的快递查询和PVE爱快等用到action节点的全部不工作。每次部署都会导致node-red重启一下,日志中有如下报错。
RED.settings.functionGlobalContext.get is not a function

/node_modules/node-red-contrib-actionflows/actionflows/actionflows.js:270:51

搜索了一下,原来是节点使用了未发布的api,新版给去掉了。
开发者在考虑是否恢复还是应该让节点作者升级。

https://discourse.nodered.org/t/problem-with-node-red-contrib-actionflows-since-upgrade-to-2-2-0/57368/13


We made some internal changes in Node-RED with how global context is managed - and this error is a side-effect of that.

Using RED.settings.functionGlobalContext as way to access global context was never documented as a suitable way of doing it. The fact these nodes are broken because they took that approach, isn't ideal, but nor have we changed a published API.

We need to think about what to do here - should we revert our change to keep things working, or encourage these nodes to use proper APIs.



回复中也提到最好使用link call节点代替,才是最好的方案。


https://nodered.org/blog/2021/10/21/version-2-1-released#new-link-call-node

New Link Call node
The new Link Call node can be used alongside the Link-In/Out nodes to create subroutine-like flows.

If you have a flow that starts with a Link-In node and ends with a Link-Out node that has been put into its new ‘return’ mode (giving the node a different icon), the Link Call node can be used to pass that flow a message and the result is passed back to the calling node.


As an alternative to using subflows, this is great for creating little utility flows that you want to reuse in multiple places.


花了约大半小时将所有的action节点全部换成link call后,终于正常运行。



回复

使用道具 举报

46

主题

1654

帖子

6676

积分

论坛元老

Rank: 8Rank: 8

积分
6676
金钱
5012
HASS币
40
发表于 2022-2-1 22:31:54 | 显示全部楼层
论坛有你更精彩
折腾精神永存,感恩感谢论坛每一位愿意分享和帮助过我的大佬,论坛有你更精彩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 12:14 , Processed in 0.056592 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表