NodeJs serialport error

Hi

my nodejs in windows works great with the serialport nodejs library. when i push it to the fin it fails installing the module

I have encounter this problem before. seems that if i dont create the the nodejs on a linux system it wont work when pushing from windows to linux…

is there a way around this?

> @serialport/bindings@9.2.0 install /usr/src/app/node_modules/@serialport/bindings                                                                                                                                               [main]     > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild                                                                                                                                                         [main]     prebuild-install WARN                                                                                                                                                                                                             [main]     install No prebuilt binaries found (target=10.24.1 runtime=node arch=arm libc= platform=linux)                                                                                                                                    [main]                                                                                                                                                                                                                                       [main]     gyp                                                                                                                                                                                                                               [main]      ERR!                                                                                                                                                                                                                             [main]      find Python                                                                                                                                                                                                                      [main]                                                                                                                                                                                                                                       [main]                                                                                                                                                                                                                                       [main]     gyp                                                                                                                                                                                                                               [main]     ERR!                                                                                                                                                                                                                              [main]     find Python Python is not set from command line or npm configuration                                                                                                                                                              [main]                                                                                                                                                                                                                                       [main]     gyp                                                                                                                                                                                                                               [main]     ERR!                                                                                                                                                                                                                              [main]     find Python Python is not set from environment variable PYTHON                                                                                                                                                                    [main]                                                                                                                                                                                                                                       [main]     gyp                                                                                                                                                                                                                               [main]      ERR!                                                                                                                                                                                                                             [main]      find Python                                                                                                                                                                                                                      [main]      checking if "python" can be used                                                                                                                                                                                                 [main]                                                                                                                                                                                                                                       [main]     gyp                                                                                                                       

Hi

The documentation for serialport library is a little confusing to me. On this page it says that this is not supported on Arm : https://serialport.io/docs/guide-platform-support

But I did find some other pages on their docs saying that it works on the Pi. Is there some other library that might work for you?

I have used it on the pi succesfully but I need to build the nodejs application on the Pi. I guess i will have to do something like that, dont know what is the deal with tha library when using nodejs

I may try python then, thanks

Hi, how are you pushing the applications to your device? A container built for one architecture won’t work when run on a device with a different architecture, so I’m wondering about the process you are using.

Yes i was using windows to build it and deploy it. I needed to be using raspberry pi to deploy it for it to work. Since i did not want to do that i got it working already on python.

Glad it worked out for you in the end. I did find these RPi instructions to install Serialport but I am sure you have seen them already https://serialport.io/docs/guide-installation#raspberry-pi-linux
Please drop your Dockerfile or any references that helped you made it work by using Pyserial I assume. This will help folks visiting the thread in the future. Thanks!

Though some clarification would certainly help, as to “why you needed a RaspberryPi to deploy it for it to work”. You could create a container with the base image as Docker Hub and install serialport in the Dockerfile along with other packages that you need. You can then balena push (Deploy to your fleet - Balena Documentation) said container to be built using balena builders that way you won’t need to build the image using a RPi. Let me know if this is something you did try and didn’t work out. Happy to help.

Here’s a getting started guide for balenaFin + node if you are looking for more context Get started with Balena Fin (CM3) and Node.js - Balena Documentation

What worked for me in other projects not related with balena but with serialport and nodejs is to build it on the raspberry pi and put it on git.

Then you can edit on windows but it won work on windows lol… you can make the edits on windows, push it to git.

then on the raspberry pi pull it from git and test it.

I am not very familiar on the software part on how nodejs works under the hood with those libraries.

but yes you cannot build a node js application in windows using the serial port and then deploy it to the pi.

how ever you can start the build in the raspberry pi, push it to git, edit on windows(wont be able to debug it there serialport wont work), pull git on raspberry pi and test.

how ever you can start the build in the raspberry pi, push it to git, edit on windows(wont be able to debug it there serialport wont work), pull git on raspberry pi and test.

Thanks for the clarification. As far as I understood, I think using the balena builder and the many tools that we have available can effectively ease the process you described above. I will reiterate on what I thought you meant is, you are building an application using serialport that needs to run on a RaspberryPi. You push to git so as to edit the code on Windows and then you push it back to git to debug and execute on the RPi.

What I suggest is instead of the doing the back forth with git. You can run your application as part of a container that can be pushed to your device using balena push. With this process, you won’t have to worry about architecture compatibility (x86 and arm) as balena builders will build the image (Your application) as per the target device architecture (which is RaspberryPi). To understand this flow better, I highly recommend trying out our Getting Started guide once that I linked above. We have the guide available in Python as well. Hope it helps in your work in some way.