GPSD appears to prevent system from loading

Hi,

I am fairly new to Pi despite years of Windows programming and after my first fairly intense day with the totally brilliant Node-RED, am marvelling at its usefulness.

Using Palette, I installed GPSD into a very successful flow and it appears to have messed up everything. Starting up Node-Red I get......

16 May 16:44:53 - [info] Starting flows
16 May 16:44:53 - [info] [gpsd:edcf736f.9623e8] Registering "tpv" event
16 May 16:44:53 - [info] Started flows
16 May 16:44:53 - [red] Uncaught Exception:
16 May 16:44:53 - TypeError: Cannot read property 'log' of undefined

  • at log_helper (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:496:16)*
  • at Object.Node.error (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:524:9)*
  • at Socket. (/home/pi/.node-red/node_modules/node-gpsd/lib/gpsd.js:72:25)*
  • at Socket.emit (events.js:376:20)*
  • at emitErrorNT (internal/streams/destroy.js:106:8)*
  • at emitErrorCloseNT (internal/streams/destroy.js:74:3)*
  • at processTicksAndRejections (internal/process/task_queues.js:82:21)*
    nodered.service: Main process exited, code=exited, status=1/FAILURE
    nodered.service: Failed with result 'exit-code'.

Can anyone please advise as to how I can remove GPSD from the system? Is there an editable file listing all the additional nodes introduced so I can stop the system looking for GPSD?

I really would like to keep the flow which I have created so far.

Many thanks for reading this - all guidance gratefully received!

Welcome to the forum @NPT

If you start node-red in a terminal using the command
node-red --safe
then it will start it in safe mode without starting the flows. Then you should be able to do what you want. If node-red still crashes straight away then you will have to remove it from the command line. In that case tell us what you installed and exactly how.

1 Like

Hi Colin,

Many thanks for the speedy response!

Brilliant success with Safe Mode and I was able to disable and remove the suspect GPSD node.

I shall experiment with it in a new flow. So much to learn and such little............

Cheers,

NPT

1 Like

Hi there - same issue here as well. An alternative workaround is also to navigate to
"cd /home/pi/.node-red/"
and restore the previous flow from backup
"mv .flows_raspberrypi.json.backup flows_raspberrypi.json"

It is however a bit frustrating that only adding the gpsd node is breaking everything, regardless if it is added on a separate flow or in the main or whatever..
Checking gpsd from outside node-red with gpsmon or cgps shows good looking data and 3D fix.

Any idea?

Which node are you using? Possibly node-red-contrib-something.

Hei Colin,
I'm using node-red-contrib-gpsd
not sure if there is anything better?

It seems an issue has been raised against the node for this problem, but it has not been addressed. The other two issues there have been open for more than a year and have also not been addressed so it seems the node is no longer supported. I don't know about alternatives.

Thanks a lot Colin – I’ve tried logging a similar question into the Slack channel.

I’ll keep this issue posted If I get something out of it.

Domenico

While I've not tested this as I don't have my GPS setup at the moment the quick fix will be to comment out lines 55-59 of gpsd.js in the node-red-contrib-gpsd node.

I'll try and find time over the weekend to fix it properly and submit a PR to the node owner, but since it's not been touched in 5 years I'm not confident

Pull request submitted Fix to work with Node-RED 1.3.x by hardillb · Pull Request #5 · damoclark/node-red-contrib-gpsd · GitHub

in the mean time you can install my fixed fork with

npm install hardillb/node-red-contrib-gpsd

Run that in your userDir (e.g. ~/.node-red)

1 Like

Also new to Node-Red, but have a project where I think it can be a good solution.
Initially installed on RaspberryPi as included package and had the "gpsd example flow" from here working: node-red-contrib-gpsd (node) - Node-RED with gpsd installed from the palette.

Had problems getting a non-official 7" touch screen working (touch part of it) and updated the system which is now reported as Linux raspberrypi 5.10.17-v7+ #1421 SMP Thu May 27 13:59:01 BST 2021 armv7l GNU/Linux. The touch screen problem was power related and now sorted.

However, after the update I got the TypeError: Cannot read property 'log' of undefined problem mentioned above.
I've now uninstalled Node-Red and re-installed using the script here: Running on Raspberry Pi : Node-RED, the menu says v1.2.9. Also tried to install the fixed fork above, node-red-contrib-gpsd is 1.0.2 in palette.
I now get a new error when I deploy the example flow mentioned above:
17 Jun 17:36:01 - [info] Started flows
17 Jun 17:36:01 - [info] [gpsd:Adafruit Ultimate GPS] Socket connected.
17 Jun 17:36:01 - [info] [gpsd:Adafruit Ultimate GPS] Connected to gpsd
17 Jun 17:36:01 - [red] Uncaught Exception:
17 Jun 17:36:01 - ReferenceError: listener is not defined
at /home/pi/.node-red/node_modules/node-red-contrib-gpsd/gpsd/gpsd.js:188:4
at Socket. (/home/pi/.node-red/node_modules/node-gpsd/lib/gpsd.js:125:11)
at Object.onceWrapper (events.js:481:28)
at Socket.emit (events.js:387:35)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:10)

Not sure where to start troubleshooting. The fix from hardillb mentions Node-Red >=1.3.0 and I have 1.2.9, the fix should also be 1.0.3 and not 1.0.2. Not sure to update Node-Red to a newer version, if the fix was really updated, or if it doesn't apply for 1.2.9.

Any ideas for the best way of solving this?

Thanks,
Eivind

On starting after trying another update using the script I noticed tha v1.3.5 is actually installed. Not sure what v1.2.9 in the menu is.

7 Jun 20:03:54 - [info] Node-RED version: v1.3.5
17 Jun 20:03:54 - [info] Node.js version: v14.17.1
17 Jun 20:03:54 - [info] Linux 5.10.17-v7+ arm LE
17 Jun 20:03:55 - [info] Loading palette nodes
17 Jun 20:03:58 - [info] Worldmap version 2.15.0
17 Jun 20:03:59 - [info] Dashboard version 2.29.1 started at /ui
17 Jun 20:03:59 - [info] Settings file : /home/pi/.node-red/settings.js
17 Jun 20:03:59 - [info] Context store : 'default' [module=memory]
17 Jun 20:03:59 - [info] User directory : /home/pi/.node-red
17 Jun 20:03:59 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 Jun 20:03:59 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
17 Jun 20:03:59 - [info] Server now running at http://127.0.0.1:1880/

You are now running the latest non v2 of node-red. @hardillb fix should work on this release. From your last post, it looks like node-red is running, have you installed the node from his library? Is it still a problem?

Thank you for your reply.
After a reboot of both the pi (and laptop where I see/operate the dashboard) I now have v1.3.5 in the Node-red menu and 1.0.3 in palette for node-red-contrib-gpsd. Not sure why, did several reboots of the pi earlier and don't think the laptop should matter.

Anyway, still have the same ReferenceError. May not be related to the initial TypeError and fix in this thread, but still related to gpsd. Will it be better to move this to a separate thread?

18 Jun 08:00:04 - [info] Starting flows
18 Jun 08:00:04 - [info] [gpsd:Adafruit Ultimate GPS] Registering "tpv" event
18 Jun 08:00:04 - [info] [gpsd:Adafruit Ultimate GPS] Registering "sky" event
18 Jun 08:00:04 - [info] [gpsd:Adafruit Ultimate GPS] Registering "device" event
18 Jun 08:00:04 - [info] Started flows
18 Jun 08:00:04 - [info] [gpsd:Adafruit Ultimate GPS] Socket connected.
18 Jun 08:00:04 - [info] [gpsd:Adafruit Ultimate GPS] Connected to gpsd
18 Jun 08:00:04 - [red] Uncaught Exception:
18 Jun 08:00:04 - ReferenceError: listener is not defined
at /home/pi/.node-red/node_modules/node-red-contrib-gpsd/gpsd/gpsd.js:188:4
at Socket. (/home/pi/.node-red/node_modules/node-gpsd/lib/gpsd.js:125:11)
at Object.onceWrapper (events.js:481:28)
at Socket.emit (events.js:387:35)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:10)

Edit line 188 of /home/pi/.node-red/node_modules/node-red-contrib-gpsd/gpsd/gpsd.js to add node. before listener.watch();

This has already been fixed and published as 1.0.4

1 Like

Thank you!
Adding node. to the file made it work again.

I'll look into upgrading to 1.0.4 as well.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.