nobodyMO / node-red-contrib-piface-digital

4 stars 4 forks source link

Can not install node-red-contrib-piface-digital #3

Open Tobi-BPi opened 3 years ago

Tobi-BPi commented 3 years ago

Hey NobodyMO,

i tryed to install your node in IOBROKER Ned-Red but it will not work.

I opend allready a issue https://github.com/tualo/node-pifacedigital/issues/9 So, your system is build on this basement.

could be this is the reason.

Do you have any idea in this case?

Thx tobi

nobodyMO commented 3 years ago

have you already installed tualo/node-pifacedigital? Did that work or was there an error message? I saw that you used sudo npm install. npm should normally be used without sudo.

Did you try the installation with the parameter npm install --unsafe-perm?

npm install --unsafe-perm --verbose -g node-pifacedigital

or maybe

sudo npm install --unsafe-perm --verbose -g node-pifacedigital

in the linked issue, sudo is the problem, because sudo is not the same as using the root user. This sudo, gyp tries to use the /root directory, but the current linux user has no access rights to this folder.

Tobi-BPi commented 3 years ago

Hey Nobody, nice to see you here!

I tryed all install command from tualo now in real root shell. with the normal tualo command npm install node-pifacedigital -g the same Errors like PI user i tryed the --unsafe-perm but also this ended with a Error and procedure a logfile.

my system is RPI4 with latest RaspiOS (Buster) complete new created

nobodyMO commented 3 years ago

I tried the installation of node-pifacedigital on my pi2. The installation with nodejs 12 is not possible at the moment. The error seems to indicate that compiling only works up to nodejs 8. Without adjustments to the c++ code in src/cpp/NPIFaceDigital.h the node will not work unfortunately.

Tobi-BPi commented 3 years ago

HI!

you know me.. i'm just a User (DAU) :-) Who could/must do that?

I read in the IOBROKER Forum, many node's have the problem with new nodejs versions. So every new major version had to be integrated nodejs new API. Is this one of the Problems?

nobodyMO commented 3 years ago

The problem lies in node-pifacedigital.

The installation of the module has always been difficult because a script for code compilation used relative paths to the previously installed libraries (prerequisites). But now it cannot be installed at all because the compilation generates errors. In the case of piface, we are talking about an hardware extension for raspberry. These are normally accessed via C or C++ libraries. The necessary libraries are exactly those which are installed via the prerequisites.

node-pifacedigital translates the functions of the c++ libraries as javascript functions to nodejs by using these c++ libraries.

To be able to call C++ functions in a node, there is an extension for nodejs called Native Abstractions for Node.js (nan).

And here is the problem. While javascript code mostly runs with newer nodejs versions there are often changes to the external C++ interface of nodejs witch is used for interface wrappers. That's why extensions that access c++ libraries sometimes can't be compiled under new nodejs versions. The c++ code has to be adapted to be compatible with the new nodejs version.

Since the project has not been changed for a long time, no one has done that yet.

But I can't do it for you, because I haven't developed with c++ for years and I don't know the current nan interface.