narioinc / node-rgb-matrix

A nodejs express server to control RGB Matrix based on HUB75 connector using JS Canvas APIs. Advanced Layers and Animation support available OOB
Apache License 2.0
5 stars 1 forks source link

Error: Could not locate the bindings file #1

Open riffnshred opened 6 months ago

riffnshred commented 6 months ago

Following your instructions and I'm getting this error

Error: Could not locate the bindings file.

Running Node.js v20.12.2 on the latest raspberry pi OS on a Pi Zero 2W

narioinc commented 6 months ago

@riffnshred

Thanks for giving the project a try. Sorry for the late response as I was held up in some official work here.

Could you share the output from the command line as you follow the steps ?

It will help me check the same on my pi zero 2w here to see if I can reproduce the issue. Right now I have tested with a 2, 3b 3b+ and 4.

riffnshred commented 6 months ago

So I poked a bit more after I posted this issue and what I found is that the dependencies don't install. When I try to install them manually, It throws different errors. I stopped there but I think what is going on is that the latest version of raspberry pi OS block the installation. By default, the new Pi OS require that you use a virtual environment and install packages of you project in there.

This is just an hypostasis but for the last few months I had to start create virtual environment for my projects in order to properly set them up and run .

riffnshred commented 6 months ago

So look like I'm wrong. I get the same errors under a virtual environment. here's a paste bin of what I get when I run. I'm running nodejs v18.20.2.

https://pastebin.com/DdCDFtqw

narioinc commented 6 months ago

@riffnshred Thanks for sharing the pastebin, I am going to try this virtual setup on both the 2w and 3 just in case and see where the errors stem from

The nodejs library uses NAPI to talk to hzeller c library + the node canvas impl and I am guessing that there is something getting screwed up there. Let me get back to you today.

Could you point me to what you are referring to " setting up virtual environment on rpi". I remember doing this for python but never for nodejs so just curious.

narioinc commented 6 months ago

@riffnshred

Are you referring to using nodeenv to setup virtual environment for nodejs ??

narioinc commented 6 months ago

@riffnshred

I think I got it. Since my project is a nodejs project you won't need a python venv to be setup 🙂 !!

Just pull this repo manually to a user directory and follow the steps again. That should fix your issues.

The problem with python venv is that it will not work correctly with the nodejs folder structure for packages and C compilation targets.

Meanwhile, I'll give it a try on my 2w today as soon as I reach home.

riffnshred commented 6 months ago

That is what I did the first time and got the same result. I think it might be the version of node.js I install. I'll be franc, it's the first time I use node.js . do you have a guide you can share on how to install node js on a raspberry pi ?

This is the one I use: https://pimylifeup.com/raspberry-pi-nodejs/

I install version 18 of node. Could it be that canvas is not supported on V18 ?

riffnshred commented 6 months ago

also, which version of raspberry pi are you using.

narioinc commented 6 months ago

That is what I did the first time and got the same result. I think it might be the version of node.js I install. I'll be franc, it's the first time I use node.js . do you have a guide you can share on how to install node js on a raspberry pi ?

This is the one I use: https://pimylifeup.com/raspberry-pi-nodejs/

I install version 18 of node. Could it be that canvas is not supported on V18 ?

Hi @riffnshred

The node canvas API only has a minimum requirement for node and that is 6.0.0....so essentially it should run without any issues in any version of node higher than 6.0.0

I'll be testing the implenebtation tonight on the rpi 2w running rpi OS version release date of March 15th 2024.

In the mean time, the best way to setup node on Debian Linux is here : https://nodejs.org/en/download/package-manager

Best combination is Version - 20.12.2 OS - Linux Tool - nvm

riffnshred commented 6 months ago

Which version of Linux are you using. could you link to the image so I can install it?

Thanks for helping out. really appreciate it.

EDIT:

Sorry, I miss read. you use Debian. Are you using raspberry pi OS on your raspberry pi? or straight up Debian ?

narioinc commented 6 months ago

So I am creating an SD card using the rpi imager tool and I select the latest image that the tool can burn to an SD card

If you are using a different tool then you can download the latest image using this url

https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-03-15/2024-03-15-raspios-bookworm-arm64-lite.img.xz

This is the official download so you can use it without any issues. !!

Also I am going to update a few linux packages that are pre-req. Will keep you posted.

riffnshred commented 6 months ago

Ok same here, but I'm installing the Lite version of the latest Pi OS (No Desktop environment). I'll give the other one a try.

narioinc commented 6 months ago

Me too. I am using the lite version as well. The link that I shared is that of the latest lite version

One thing that I am seeing on the rpi zero 2w is that the npm install is terribly slow and just gets stuck for me. Wasn't the case on the full blown rpi 2

Will keep you posted

riffnshred commented 6 months ago

Me too. I am using the lite version as well. The link that I shared is that of the latest lite version

One thing that I am seeing on the rpi zero 2w is that the npm install is terribly slow and just gets stuck for me. Wasn't the case on the full blown rpi 2

Will keep you posted

Same here. not sure why as the Pi 2W is a Pi 3A+ in a smaller factor.

riffnshred commented 6 months ago

you use the 64bit or 32 bit version of Pi OS?

narioinc commented 6 months ago

you use the 64bit or 32 bit version of Pi OS?

64bit. Sorry for missing out that detail.

narioinc commented 6 months ago

@riffnshred

I just tested after a few minor changes to the package.json file and it worked on the rpi zero 2 w

Just see the new section I have added to the readme file called "note for rpi zero 2w users"

Please try a fresh install and it should work !!

narioinc commented 6 months ago

@riffnshred however, the animations are not very smooth on the rpi zero 2w given the processors capabilities

I would definitely suggest a rpi 3 or above for the best 60fps experience, especially with my advanced physics examples.

riffnshred commented 6 months ago

thanks I'll give it a try.

For my use case, Im looking for an easier way to build layouts as my project is showing data on screen.

I also found out that the Pi Zero 2W is a slight underclock version of Pi 3, so that would explain why it is slower. I'm curious to see the performance if it's overclocked.

narioinc commented 6 months ago

thanks I'll give it a try.

For my use case, Im looking for an easier way to build layouts as my project is showing data on screen.

I also found out that the Pi Zero 2W is a slight underclock version of Pi 3, so that would explain why it is slower. I'm curious to see the performance if it's overclocked.

Awesome, you can build quite complex layouts as I have made sure that integration works nicely with Konva !! You can even add animations to your layouts.

I also have added support for easeljs in case you want to create a lot of generative art or advanced canvas layer render logic.

The original library by hzeller was quite low level and only handled raw pixel manipulations. As soon as I found out about JS canvas APIs and getting the canvas to render on the led Matrix.....it opened up a whole lot of possibilities !!

Regarding an overclock:

I remember I had made the config.txt changes to clock the processor at 1400 but wasnt stable even after adding a small noctua fan and a heatsink, maybe the SoC bin that is on my zero 2w doesn't clock well. However you can try and let me know. I wasn't sure if the zero 2w can keep up the framerates at 60fps .... You may have to disable BCM audio kernel modules as mentioned here https://github.com/hzeller/rpi-rgb-led-matrix?tab=readme-ov-file#use-minimal-raspbian-distribution

The author also mentions that dietpi OS is much smaller and better than raspbian lite https://dietpi.com/ You could give it a try.

riffnshred commented 6 months ago

Thanks man, I will definitely try different things. I have not thought about dietpi, which might actually provide that bit of a boost I need.

Thanks for all the help !!!

narioinc commented 6 months ago

Thanks man, I will definitely try different things. I have not thought about dietpi, which might actually provide that bit of a boost I need.

Thanks for all the help !!!

Always welcome....looking forward to what you create with it !!