monteslu / node-red-contrib-gpio

A set of node-red nodes for connecting to johnny-five IO Plugins
MIT License
41 stars 31 forks source link

TypeError: boardModule is not a constructor #37

Open pleemans67 opened 5 years ago

pleemans67 commented 5 years ago

Hi, I installed the raspi-io plugin in conjunction with the node-red-contrib-gpio.

I get the following error when i try to use one of the nodes:

error initializing io class raspi-io TypeError: boardModule is not a constructor

pleemans67 commented 5 years ago

maybe to add as information: board = Raspberry Pi Model 3B+

T3rorx commented 5 years ago

I have the same problem did you have solve it ? Where i can specify "board = Raspberry Pi Model 3B+" ?

Thanks

monteslu commented 5 years ago

not sure it'll fix this (haven't tried on a recent pi), but did you install raspi-io as a normal user and run it as root? https://github.com/nebrius/raspi-io#system-requirements

T3rorx commented 5 years ago

when you say run is for node-red run as root ?

monteslu commented 5 years ago

yeah unfortunately. GPIOs from raspi-io can only be accessed with root, so node-red has to be run as root. The other pi nodes that hit the GPIOs depend on another service that is also running as root.

T3rorx commented 5 years ago

Start node-red as Pi user : TypeError: boardModule is not a constructor in root : Error: Cannot find module 'raspi-io'

Not work for me.

Laca81 commented 5 years ago

Hi All!

The problem is the node-red-contrib-gpio is not compatible with the raspi-io 10.0.x. If you downgrade to 9.0.1 or change the nodebotNode.js -> line 249 from: node.io = new boardModule(); to node.io = new boardModule.RaspiIO();

then it should work.

Bests, Laca

monteslu commented 5 years ago

how about something like

node.io = boardModule.RaspiIO ? new boardModule.RaspiIO() : new boardModule()

or maybe something smarter above that can check for other IO classes that follow the raspio pattern?

Anyone care to make a PR for this?

spade69 commented 5 years ago

meet the same problem here, my board is PI 4B