bitfocus / companion-module-raspberry-gpio

MIT License
5 stars 0 forks source link

GPIO crashes on Rpi4 #13

Closed RobJLocke closed 3 months ago

RobJLocke commented 3 months ago

GPIO module installed in /opt... web interface warns of problems - module crashes Log reads error: node:internal/errors:496 ErrorCaptureStackTrace(err); ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@companion-module/base' imported from /opt/companion/module-legacy/manifests/companion-module-raspberry-gpio/lib/main.js at new NodeError (node:internal/errors:405:5) at packageResolve (node:internal/modules/esm/resolve:890:9) at moduleResolve (node:internal/modules/esm/resolve:939:20) at defaultResolve (node:internal/modules/esm/resolve:1132:11) at nextResolve (node:internal/modules/esm/loader:163:28) at ESMLoader.resolve (node:internal/modules/esm/loader:835:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:77:40) at link (node:internal/modules/esm/module_job:76:36) { code: 'ERR_MODULE_NOT_FOUND' }

Node.js v18.18.1

Not sure what to do here

istnv commented 3 months ago

The base module has not been packaged so the libraries needed are not included. You will need to install yarn: sudo npm install -g yarn Then in the raspberry-gpio directory: sudo yarn Rebuild the onoff library: sudo yarn add onoff

The required libraries will be downloaded and installed. Your Pi needs to be online for this.

RobJLocke commented 3 months ago

npm and yarn installed. When I run yarn in the raspberry-gpio directory

Syntax Error: “Unexpected end of JSON input” in ~manifests/package.json. This is a blank document/file.

Tried one or two other directories – same result.

Companion log reads:

error: node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package @.***/base' imported from /opt/companion/module-legacy/manifests/companion-module-raspberry-gpio/lib/main.js

at new NodeError (node:internal/errors:405:5)

at packageResolve (node:internal/modules/esm/resolve:890:9)

at moduleResolve (node:internal/modules/esm/resolve:939:20)

at defaultResolve (node:internal/modules/esm/resolve:1132:11)

at nextResolve (node:internal/modules/esm/loader:163:28)

at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)

at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)

at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)

at link (node:internal/modules/esm/module_job:76:36) {

code: 'ERR_MODULE_NOT_FOUND'

}

Node.js v18.18.1

Something not right somewhere, but novice level in linux or js. Have I missed something earlier in the process?

R

From: John Knight Jr @.> Sent: Sunday, March 17, 2024 1:01 AM To: bitfocus/companion-module-raspberry-gpio @.> Cc: RobJLocke @.>; Author @.> Subject: Re: [bitfocus/companion-module-raspberry-gpio] GPIO crashes on Rpi4 (Issue #13)

The base module has not been packaged so the libraries needed are not included. You will need to install yarn: sudo npm install -g yarn Then in the raspberry-gpio directory: sudo yarn

The required libraries will be downloaded and installed. Your Pi needs to be online for this.

— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion-module-raspberry-gpio/issues/13#issuecomment-2002215456 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVS6TDEPFYHUZ4TP3RKFPTYYTTMFAVCNFSM6AAAAABEZWAMP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGIYTKNBVGY . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ABVS6THJC3UF5FZLOHP77PTYYTTMFA5CNFSM6AAAAABEZWAMP6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTXK5RCA.gif Message ID: @. @.> >

istnv commented 3 months ago

I missed what directory where you had installed the module, sorry. Remove it from the /opt/companion/module-legacy directory, that will cause the errors you are getting. You want to clone the module into /opt/companion-module-dev/raspberry-gpio:

$ cd /opt/companion-module-dev
$ sudo git clone https://github.com/bitfocus/companion-module-raspberry-gpio.git raspberry-gpio

Then cd into the new raspberry-gpio directory and run the yarn sequence I posted earlier.

RobJLocke commented 3 months ago

That seemed to work – Pi GPIO appeared in list of “good” modules. Starts and has config page

The final issue now is one of:

system: Connection started

Starting up module class: GpioInstance

Sentry disabled

Module-host accepted registration

error: GPIO is inaccessible

pigpio is installed. Tried the remote GPIO in raspi-config on and off.

Companion is already a member of gpio group.

Last hurdle I think , but not sure what else to try

R

From: John Knight Jr @.> Sent: Sunday, March 17, 2024 7:03 PM To: bitfocus/companion-module-raspberry-gpio @.> Cc: RobJLocke @.>; Author @.> Subject: Re: [bitfocus/companion-module-raspberry-gpio] GPIO crashes on Rpi4 (Issue #13)

I missed what directory where you had installed the module, sorry. Remove it from the /opt/companion/module-legacy directory, that will cause the errors you are getting. You want to clone the module into /opt/companion-module-dev/raspberry-gpio:

$ cd /opt/companion-module-dev $ sudo git clone https://github.com/bitfocus/companion-module-raspberry-gpio.git raspberry-gpio

Then cd into the new raspberry-gpio directory and run the yarn sequence I posted earlier.

— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion-module-raspberry-gpio/issues/13#issuecomment-2002580907 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVS6THIT7MHJKTFGBFEGGDYYXSH7AVCNFSM6AAAAABEZWAMP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGU4DAOJQG4 . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ABVS6TAKFOWKVNHT3Z4UE4TYYXSH7A5CNFSM6AAAAABEZWAMP6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTXLT22W.gif Message ID: @. @.> >

istnv commented 3 months ago

The only way I cleared the no access error was to rebuild onoff cd to the repository directory, then: $ sudo yarn add onoff

Then reboot.

RobJLocke commented 3 months ago

Could you clarify repository directory. Is it within the  / opt structure or elsewhere?  Sorry not very familiar with where programme parts end up in linuxSent from Outlook for Android

istnv commented 3 months ago

That is the directory you copied the module into: /opt/companion-module-dev/raspberry-gpio

RobJLocke commented 3 months ago

A typo on my part. Many thanks for all the help. I have a green tick, log has info only lines. Now to the physical build....BestSent from Outlook for Android