sonntam / node-red-contrib-xstate-machine

A xstate-based state machine implementation using state-machine-cat visualization for node red.
MIT License
22 stars 8 forks source link

Docker install: "Flows stopped due to missing node types. smxstate" #2

Closed zoltanszalontay closed 4 years ago

zoltanszalontay commented 4 years ago

I am running Node-RED (0.20.7) on my Raspberry Pi in Docker (19.03.8). (The reason for the specific Node-RED version is an incompatibility with IKEA Tradfri of builds above 1.0).

When I want to install node-red-contrib-xstate-machine using the palette, the following happens:

However, when I want to deploy the changes, I get the following error message:

Flows stopped due to missing node types. smxstate

Checking Node-RED log, the dependencies failed to install:

12 Apr 23:59:56 - [info] Waiting for missing types to be registered:, 12 Apr 23:59:56 - [info] - smxstate

The tail of "npm install node-red-contrib-xstate-machine" in the Docker container console output is:

npm info lifecycle acorn@7.1.1~postinstall: acorn@7.1.1 npm info lifecycle abab@2.0.3~postinstall: abab@2.0.3 npm info lifecycle @types/color-name@1.1.1~postinstall: @types/color-name@1.1.1 npm info lifecycle undefined~preshrinkwrap: undefined npm info lifecycle undefined~shrinkwrap: undefined npm info lifecycle undefined~postshrinkwrap: undefined npm WARN jsdom@16.2.2 requires a peer of canvas@^2.5.0 but none was installed. npm WARN ws@7.2.3 requires a peer of bufferutil@^4.0.1 but none was installed. npm WARN ws@7.2.3 requires a peer of utf-8-validate@^5.0.2 but none was installed.

  • node-red-contrib-xstate-machine@0.1.4 added 103 packages in 38.402s npm info ok

Any idea why these dependencies do not install?

Thx

sonntam commented 4 years ago

It seems that there are peer dependencies that are not installed. Peer dependencies are not installed automatically by default as they indicate incompatibilities of plugins to the installed main app most of the time.

I haven't looked at node-red ^0.20.x yet. I'll try to reproduce the problem tomorrow. Thank you for bringing it up!

sonntam commented 4 years ago

@zoltanszalontay I have installed a fresh copy of node-red 0.20.7 and installed the node-red-contrib-xstate-machine package via the palette manager.

I don't seem to have any issue with it. It's working without a problem apart from the sidebar styling being not correct due to a breaking change in node-red from 0.20.x to 1.x.

Also the peer dependencies that you mentioned are not installed in my instance at all. Can you tell me what npm version and node version you are running (npm -v and node -v). Thanks!

nodered

Here is my npm output from installing via palette manager:

-----------------------------------------------------------
2020-04-13T09:51:58.418Z installieren : node-red-contrib-xstate-machine 0.1.4

2020-04-13T09:51:58.745Z npm.cmd install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-xstate-machine@0.1.4
2020-04-13T09:52:04.400Z [err] npm
2020-04-13T09:52:04.401Z [err]  WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
2020-04-13T09:52:24.362Z [out] 
2020-04-13T09:52:24.362Z [out] > fast-xml-parser@3.16.0 postinstall \node-red-contrib-xstate-machine\tmp\node_modules\fast-xml-parser
2020-04-13T09:52:24.362Z [out] > node tasks/postinstall.js || exit 0
2020-04-13T09:52:24.362Z [out] 
2020-04-13T09:52:24.468Z [out] Love fast-xml-parser? Check https://amitkumargupta.work for more projects and contribution.
2020-04-13T09:52:24.468Z [out] 
2020-04-13T09:52:24.989Z [out] + node-red-contrib-xstate-machine@0.1.4
2020-04-13T09:52:24.989Z [out] added 151 packages from 153 contributors in 24.313s
2020-04-13T09:52:25.092Z [out] 

2020-04-13T09:52:25.092Z [out] 3 packages are looking for funding

2020-04-13T09:52:25.092Z [out]   run `npm fund` for details
2020-04-13T09:52:25.092Z [out] 
2020-04-13T09:52:25.125Z rc=0
zoltanszalontay commented 4 years ago

Weird. I removed my 0.20.7 NR container and deployed the latest availabe for RPi. It installs, and compains about Tradfri, but nevermind. It registers correctly, installs all dependencies.

However, when I load the cat example, the state machine graph does not show up. Hourglass takes forever. The log is normal, apart from the Tradfri node warnings.

image

sonntam commented 4 years ago

@zoltanszalontay Thanky for the feedback!

The problem with rendering taking very long has been brought to my attention. I'm working on using the native graphviz renderer to speed it up a lot, see here. The related issue is #1.

May I ask what RasPi hardware you are running on (Pi1, 2, 3, 4)?

zoltanszalontay commented 4 years ago

Pi 3B+

Hardware: Raspbian Buster (10), 1GB swap, No SD card, SupTronics SSD controller, Kingston 64GB mSATA SSD, Eth0 (wlan disabled) Software: ssh enabled, docker, samba installed. Everything else is in containers: Node-RED, InfluxDB, Grafana, Mosquitto, Portainer

zoltanszalontay commented 4 years ago

FYI: Even though everything seems to be fine, the cat machine instance does not appear in the dropdown of the state machine view box.

sonntam commented 4 years ago

Pi 3B+

@zoltanszalontay That's a rather potent setup. It should only take a couple of seconds to render, even with viz.js. But as you stated you can't even select the machine from the sidebar window which indicates a problem with the client-side code running in the browser. At least the server-side code seems to run correctly.

Sorry to ping-pong so many questions back and forth:

What browser are you using? If you use Chrome or similar that has got DevTools installed, could you please check, if there are any javascript error messages being output?

zoltanszalontay commented 4 years ago

Version 81.0.4044.92 (Official Build) (64-bit)

Ouch, I checked the devtools log: image

Thanks for taking so much effort!

zoltanszalontay commented 4 years ago

Now I am running Node-RED latest official image. I removed Tradfri node and deleted all flows referring to that.

zoltanszalontay commented 4 years ago

Guess what! I reloaded the Node-RED page and it started working! I suspect it was related to Node-RED having a problem with Tradfri node.

So the workaround for me was to:

Thanks a lot for your help and have a Happy Easter! Now I can work on my LoRa communication state machine with your excellent node! :-)))

image

zoltanszalontay commented 4 years ago

For the records: SM-Cat example takes 7 secs to render on my RPi 3B+ with the config above.

sonntam commented 4 years ago

@zoltanszalontay Thank you for the in-depth information. It's good to hear that now it's working for you! I wonder though why there seems to be an incompatibility with another node-red package. I'll have to investigate.

For the records: SM-Cat example takes 7 secs to render on my RPi 3B+ with the config above.

Ouch, 7 seconds is much longer than I anticipated. On my Pi4 it only takes around 1.5 seconds to render.

disable and delete IKEA Tradfri from palette

Depending on your hardware setup maybe using the excellent zigbee2mqtt software might be an alternative to couple zigbee to node-red via mqtt. I am using it extensively and it's working like a charm!

Thanks a lot for your help and have a Happy Easter! Now I can work on my LoRa communication state machine with your excellent node! :-)))

Thank you, happy easter to you as well. I hope you have a pleasant experience doing things with the node 😉 LoRa is very intriguing to me - I'll have to check that out as well some time.

zoltanszalontay commented 4 years ago

zigbee2mqtt is on my radar :-)