bignum 作为 msg.payload 传递,只是在调试面板中没有正确呈现
这可以通过以下流程进行检查
[{"id":"4559ab0b.848204","type":"function","name":"","func":"var bignum = context.global.bignum;\n\nvar b = bignum('782910138827292261791972728324982')\n .sub('182373273283402171237474774728373')\n .div(8);\n\nmsg.payload = b;\n\nconsole.log(\"%j\", msg.payload);\nconsole.log(\"%j\", b);\nconsole.log(b);\nconsole.log(\"%j\", msg);\n\nreturn msg;","outputs":1,"noerr":0,"x":413,"y":186,"z":"6dffe97f.085fd8","wires":[["152e806f.249de8"]]},{"id":"28153711.bd78f","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":203,"y":140,"z":"6dffe97f.085fd8","wires":[["4559ab0b.848204"]]},{"id":"62001fd9.03c0c8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":712,"y":191,"z":"6dffe97f.085fd8","wires":[]},{"id":"152e806f.249de8","type":"function","name":"","func":"console.log(\"2\");\nconsole.log(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":543,"y":256,"z":"6dffe97f.085fd8","wires":[["62001fd9.03c0c8"]]}]
我会打开一个问题来看看这里
更新
这很可能是因为 bignum 没有实现 toString 方法,因此 Node-RED 不知道如何呈现输出。解决此问题的最佳方法可能是提出 bignum 而不是 Node-RED 的问题。
更新 2
Node-RED 问题具有最新信息
https://github.com/node-red/node-red/issues/690