UP board - Cannot use install mraa with npm

rarestohanean
rarestohanean New Member Posts: 5

Hi!

I bought a new UP board CHT01-A10-0232. My intention is to control GPIO using NodeJs.
I installed the new kernel from https://wiki.up-community.org/Ubuntu_18.04
I can control the pins with instructions from here: https://github.com/up-board/up-community/wiki/Pinout_UP2
When I try to install mraa following this: https://github.com/up-board/up-community/wiki/MRAA
when I run
sudo apt-get install nodejs nodejs-legacy npm
I get:

Note, selecting 'nodejs' instead of 'nodejs-legacy'
nodejs is already the newest version (8.17.0-1nodesource1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.

And then when I run npm install mraa
I get
/root/.cache/node-gyp/12.18.0/include/node/v8config.h:328:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^
../src/mraajsJAVASCRIPT_wrap.cxx: At global scope:
../src/mraajsJAVASCRIPT_wrap.cxx:907:7: error: ‘Handle’ in namespace ‘v8’ does not name a template type
v8::Handle err;

I am stuck here.
Can somebody help me please?
Thank you!

Answers

  • rarestohanean
    rarestohanean New Member Posts: 5

    NodeJs version is 12.18.0
    NPM version is 6.14.4

  • camillus
    camillus Administrator, Moderator, AAEON Posts: 188 admin
    edited December 2021

    Hi @rarestohanean ,

    I have tried to replicate this issue. First, Nodejs 7.0.0+ is not currently supported and it is advised to downgrade Nodejs version to 6.x.x to install using npm. I have tried to do this by pulling the nodejs source via curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - and then running sudo apt-get install -y nodejs to install the downgraded version but somehow it installs node v8.10.0 instead.

    Try to install using the commands below as suggested on the Wiki:

    sudo add-apt-repository ppa:mraa/mraa
    sudo apt-get update
    sudo apt-get install mraa-tools mraa-examples libmraa1 libmraa-dev libupm-dev libupm1 upm-examples
    sudo apt-get install python-mraa python3-mraa node-mraa libmraa-java

    and then try to run some nodejs examples and let us know if that works.

  • rarestohanean
    rarestohanean New Member Posts: 5

    Thank you for your answer!
    With nodejs v8.10.0 I have the same error at npm install mraa
    No success installing nodejs 6.
    Is there any other way to control the pins programmatically?
    I wouldn't go that far with nodejs 6.
    Is it possible to do it with Mono and C#?
    Is there a C++ library that I can call from NodeJS?

    Thank you!

  • camillus
    camillus Administrator, Moderator, AAEON Posts: 188 admin

    Hi @rarestohanean ,

    You can control the pins programmatically by running OS processes using C# or leveraging the libmraa python api and running python scripts controlling the pins using nodejs. Lots of possibilities.

Privacy Policy