raspi-io icon indicating copy to clipboard operation
raspi-io copied to clipboard

Installing package on non-arm/raspberry-pi

Open oligriffiths opened this issue 3 years ago • 11 comments

Hi

Can someone explain why this package has to be installed on the raspberry pi? I want to be able to commit the package to my git repo but can't install it on my macbook.

Thanks

Oli

oligriffiths avatar Nov 04 '21 16:11 oligriffiths

It relies on the C++ PiGPIO, which depends on system libraries only available on the Raspberry Pi.

You can get around this with npm install --force, however if you try and run the code it will crash on startup, and will likely also error out while trying to install.

nebrius avatar Nov 04 '21 16:11 nebrius

Thanks, I only want to checkout the code on my local machine and not run it. So long as it doesn't require any libraries on the pi to actually install then the --force command should work. Testing this with yarn install --force doesn't work however, do you know if it's a different command for yarn?

oligriffiths avatar Nov 04 '21 16:11 oligriffiths

So long as it doesn't require any libraries on the pi to actually install then the --force command should work.

IIRC the pigpio npm module needs to compile the pigpio C++ library on install, so I think it actually does require these libraries on install.

Testing this with yarn install --force doesn't work however, do you know if it's a different command for yarn?

No idea I'm afraid.

nebrius avatar Nov 04 '21 16:11 nebrius

Ah, is this why the PI needs to be rebooted after install? Because it does some kind of out-of-band install on the device?

oligriffiths avatar Nov 04 '21 16:11 oligriffiths

Ah, is this why the PI needs to be rebooted after install? Because it does some kind of out-of-band install on the device?

That's one of a couple of reasons. It also makes a few system configuration changes as well to /boot. It only needs to reboot if this is the first time installing it on the device.

nebrius avatar Nov 04 '21 16:11 nebrius

Gotcha. I'm just writing some initial setup instructions and wanted to see if I could get this package committed to the repo to make things easier, but it sounds like it needs to be setup on the device to ensure these out-of-band changes are made, unless there is some script that can be run to do this...

oligriffiths avatar Nov 04 '21 16:11 oligriffiths

Gotcha. I'm just writing some initial setup instructions and wanted to see if I could get this package committed to the repo to make things easier, but it sounds like it needs to be setup on the device to ensure these out-of-band changes are made, unless there is some script that can be run to do this...

Yes, it has to be installed via npm/yarn on the device. Generally speaking, it's bad practice to commit node_modules to a repo anyways, especially when native modules are in play (as is the case here) cause they may end up being built for the wrong target/architecture (different Pis have different targets/architectures, so a binary built for one won't necessarily run on another)

nebrius avatar Nov 04 '21 16:11 nebrius

Generally speaking, it's bad practice to commit node_modules to a repo anyways

yeah I know, I just like to do that for packages marked as not maintained in case they go away in the future.

oligriffiths avatar Nov 04 '21 17:11 oligriffiths

Generally speaking, it's bad practice to commit node_modules to a repo anyways

yeah I know, I just like to do that for packages marked as not maintained in case they go away in the future.

FWIW, packages older than 72 hours can't be deleted from npm

nebrius avatar Nov 04 '21 17:11 nebrius

Oh, good to know, thank you.

oligriffiths avatar Nov 04 '21 17:11 oligriffiths

IIRC the pigpio npm module needs to compile the pigpio C++ library on install, so I think it actually does require these libraries on install.

It should be possible to install the pigpio npm module successfully on any machine that supports Node.js. For example, here is what I see when I install it on an Intel based Linux machine:

$ node -v
v16.9.1

$ npm i pigpio

added 4 packages, and audited 5 packages in 8s

found 0 vulnerabilities
$ 

The pigpio npm module doesn't compile the pigpio C library on install. The binaries generated when the pigpio npm module is installed on a non-Pi machine will of course be completely and utterly useless at runtime. This "feature" was added to the pigpio npm module to enable developers to develop on non-Pi systems.

fivdi avatar Nov 07 '21 07:11 fivdi