2021-09-16 07:44 AM
Hi all,
I am working with a STM32MP157F-DK2 board, and I am trying to implement a Node-Red web application. I use the Openstlinux Developer package on the board and thanks to the package repository given by ST, I was able to install the NodeJS LTS version and npm. Node-Red works well, I can see all my flows in the web browser. In my application, I would like to use the node-red-node-sqlite node to access a database hosted in the STM32MP157F-DK2.
Here is my problem: During the installation process, node-pre-gyp is trying to reach an URL where are stored pre-built binaries. However, this URL returns a "Forbidden access" (see image attached), and so node-pre-gyp calls the compiler of the board to build the necessary files. Thus, I cannot install the SQLite node because it requires a compiler during the installation process, compiler that does not exist on the STM32 board.
According to the internet, this error from node-pre-gyp seems to be quite common and I did not find a solution that works, except to build files on source.
So, I would like to know if it is possible to install this node. Has anyone ever had to deal with this node-pre-gyp error on an embedded Linux board?
And if the solution is to build necessary files on source, how is it possible to accomplish that through cross-compilation with the Developer package?
Thank you in advance for your help!
Lewis
Solved! Go to Solution.
2021-09-28 05:15 AM
Hi @LewisN
The package node-red-node-sqlite is integrated in our OpenSTLinux package repository server:
root@stm32mp1:~# apt-cache policy node-red-node-sqlite
node-red-node-sqlite:
Installed: (none)
Candidate: 1.0.1-r0
Version table:
1.0.1-r0 500
500 http://packages.openstlinux.st.com/3.0 dunfell/updates armhf Packages
Best regards,
--JM
2021-09-22 12:02 AM
Hi @LewisN ,
I cannot comment for the access issue to the url. Maybe this require some specific rights ? to pay some fee ?
"because it requires a compiler during the installation process, compiler that does not exist on the STM32 board."
For this point you can make an attempt to generate a image which embed on board compilation capability.
For that you need to generate a new image with Yocto adding :
IMAGE_INSTALL_append = " packagegroup-core-buildessential"
Hope it help
Olivier
2021-09-23 01:56 AM
Hi @LewisN
I tried to build the package node-red-node-sqlite but without any success as I have still an error. I think the problem is related to npm and I am not an expert in this domain.
However, these are the steps I did from a fresh installation of the OpenSTLinux environment:
$ DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh
$ devtool add "npm://registry.npmjs.org;package=node-red-node-sqlite;version=1.0.1" `pwd`/node-red-node-sqlite
This gives you a new directory workspace/recipes/node-red-node-sqlite. This directory contains the recipe node-red-node-sqlite_1.0.1.bb and the shrinkwrap file node-red-node-sqlite/npm-shrinkwrap.json.
As the shrinkwrap file contains references to node-rep-gyp which is deprecated, I replaced them with references to @mapbox/node-rep-gyp. I also added these lines in the sqlite3 section but I think they can be removed:
"scripts": {
"install": "@mapbox/node-pre-gyp install --fallback-to-build"
},
I then copied the recipe and the shrinkwrap file in my layer and runs bitbake:
$ bitbake node-red-node-sqlite
However, I have an error related to python and I don't know how to fix it. It seems to me there is a flaw in the npm build process which uses python in one of its command while it has detected previously that python3 should be used.
I attach the recipe and the shrinkwrap file as an archive if you want to make more experiments from my work.
Best regard,
--JM
2021-09-23 09:21 AM
Hi @LewisN
I found a work-around to bypass the remaining errors and checked the installation / uninstallation of the packages on my board. I don't know if it is functional but the package is finally installed.
Could you check from the new attached archive please? If it is stable, I will push the package on our OpenSTLinux package repository server.
Best regards,
--JM
2021-09-28 05:15 AM
Hi @LewisN
The package node-red-node-sqlite is integrated in our OpenSTLinux package repository server:
root@stm32mp1:~# apt-cache policy node-red-node-sqlite
node-red-node-sqlite:
Installed: (none)
Candidate: 1.0.1-r0
Version table:
1.0.1-r0 500
500 http://packages.openstlinux.st.com/3.0 dunfell/updates armhf Packages
Best regards,
--JM
2021-10-01 07:58 AM
Hi @Community member and @Jean-Marc B,
I apologize for the late reply, I don't know why but my mailbox identified ST Community as spam, so I only saw your answers yesterday.
Thank you very much for your help, I installed the package from the OpenSTLinux package repository and it works fine.
There is just one more thing to do to make the package work with node-red: It is necessary to modify the first line of the sqlite3-binding.js file which is located in "your_path/node-red-node-sqlite/node_modules/sqlite3/lib/". This file calls the non-existent node-pre-gyp module instead of the @mapbox/node-pre-gyp module.
So, just changing the line "var binary = require('node-pre-gyp');" to "var binary = require('@mapbox/node-pre-gyp');" made everything work.
Thanks again for your support!
Best regards,
Lewis
2021-10-04 09:46 AM
Thank you @LewisN for your precious feedback.
I reverted the changes related to node-pre-gyp that were finally not relevant against the initial build problem. I can still build the package with my other changes and install it on the board. I studied and implemented a short node-red-node-sqlite example and it is functional.
So a new version of the package node-red-node-sqlite is available into the OpenSTLinux Package Repository server:
root@stm32mp1:~# apt-get update
<snap>
root@stm32mp1:~# apt-cache policy node-red-node-sqlite
node-red-node-sqlite:
Installed: (none)
Candidate: 1.0.1-r1
Version table:
1.0.1-r1 500
500 http://packages.openstlinux.st.com/3.0 dunfell/updates armhf Packages
You can install it with the command:
root@stm32mp1:~# apt-get install node-red-node-sqlite
Best regards,
--JM