本記事は、2019年のNode-REDアドベントカレンダー向けに書きました。
2019年11月時点で確認ができている、Node-REDのDashboardをIBM Cloud上で使う際に、そのままだとエラーが発生する不具合に対しての解決方法をまとめたものになります。
確認環境
node.js (runtime on IBM Cloud): v10.16.0
Node-RED: v1.0.2
node-red-dashboard: v2.17.1
node-red-contrib-ui-level: v0.1.22
node-red-contrib-ui-value-trail: v0.1.3
実行フロー
[{“id”:”d0d9f294.02d868",”type”:”ui_level”,”z”:”48eb0f07.1b9d2",”group”:”48da5c41.3146c4",”order”:4,”width”:”9",”height”:”1",”name”:””,”label”:””,”colorHi”:”#ff8080",”colorWarn”:”#ff9900",”colorNormal”:”#00b33c”,”colorOff”:”#595959",”min”:0,”max”:100,”segWarn”:””,”segHigh”:””,”unit”:”units”,”layout”:”sh”,”channelA”:””,”channelB”:””,”decimals”:0,”animations”:”soft”,”shape”:”2",”colorschema”:”fixed”,”textoptions”:”default”,”colorText”:”#eeeeee”,”fontLabel”:””,”fontValue”:””,”fontSmall”:””,”colorFromTheme”:true,”textAnimations”:false,”hideValue”:false,”tickmode”:”off”,”peakmode”:false,”peaktime”:”infinity”,”x”:1690,”y”:600,”wires”:[]},{“id”:”4f8780f9.182458",”type”:”random”,”z”:”48eb0f07.1b9d2",”name”:””,”low”:”1",”high”:”50",”inte”:”true”,”property”:”payload”,”x”:1520,”y”:600,”wires”:[[“d0d9f294.02d868”,”864ac02d.db31c8"]]},{“id”:”fe4ffddd.d76218",”type”:”inject”,”z”:”48eb0f07.1b9d2",”name”:””,”topic”:””,”payload”:””,”payloadType”:”date”,”repeat”:”1",”crontab”:””,”once”:false,”onceDelay”:0.1,”x”:1330,”y”:600,”wires”:[[“4f8780f9.182458”]]},{“id”:”864ac02d.db31c8",”type”:”ui_valuetrail”,”z”:”48eb0f07.1b9d2",”group”:”2c2b297f.f5c836",”order”:1,”width”:”3",”height”:”3",”name”:””,”label”:””,”blur”:false,”colorLine”:”#ff9900",”colorFromTheme”:true,”stroke”:2,”pointcount”:8,”x”:1700,”y”:640,”wires”:[]},{“id”:”48da5c41.3146c4",”type”:”ui_group”,”z”:””,”name”:”flowtest”,”tab”:”f97598ef.4133",”disp”:true,”width”:”12",”collapse”:false},{“id”:”2c2b297f.f5c836",”type”:”ui_group”,”z”:””,”name”:”Status”,”tab”:”5c46093a.64f518",”order”:1,”disp”:true,”width”:”6",”collapse”:false},{“id”:”f97598ef.4133",”type”:”ui_tab”,”z”:0,”name”:”Test”,”icon”:”dashboard”,”order”:6},{“id”:”5c46093a.64f518",”type”:”ui_tab”,”z”:””,”name”:”Liner level”,”icon”:”dashboard”,”order”:10,”disabled”:false,”hidden”:false}]
エラーとなるノード
node-red-contrib-ui-level
node-red-contrib-ui-value-trail
発生エラー
TypeError: Connot read property ‘push’ of undefind
原因
ライブラリのバージョン不一致
対応方法
package.jsonにdashboardとuiのバージョンを指定する
IBM CloudのNode-REDで継続的デリバリーのツールチェーンを有効化し、package.jsonのdependenciesの最後に、以下の2行を追記して下さい。
“node-red-dashboard”: “2.17.1”,
“node-red-contrib-ui-heatmap”: “2.1.3”
その後、パイプラインでビルド→ステージングが終えれば無事グラフが表示されます。
最後に
本件は、こちらの記事を参考に解決しました。
https://discourse.nodered.org/t/troubleshooting-an-error-on-ibm-cloud/16877/9
それでは!