Cross-compiling npm packages for node

I am trying to cross-compiling some npm node packages to BSP 2.8.7 by following this TipsAndTricks/NPM document.

I can fetch the npm packages by using the command ‘devtool add’ as below:

  • devtool add “npm://;name=express;version=4.17.1”
  • devtool add “npm://;name=cors;version=2.8.5”
  • devtool add “npm://;name=sqlite3;version=4.2.0”

But when I try to use the command ‘devtool build’ with the package above, for example to build the express package, it does not work and I got the errors below:

WARNING: express-4.17.1-r0 do_package: FILES contains file '/usr/lib/node_modules/express/node_modules/accepts' which resides under a directory symlink. Please fix the recipe and use the real path for the file.
ERROR: express-4.17.1-r0 do_package: File './usr/lib/node_modules/express/node_modules/accepts' cannot be packaged into 'express-accepts' because its parent directory structure does not exist. One of its parent directories is a symlink whose target directory is not included in the package.
ERROR: express-4.17.1-r0 do_package: Function failed: populate_packages
ERROR: Logfile of failure stored in: /home/vbalestero/df63ng/df63ng-imx6-bsp-287/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/express/4.17.1-r0/temp/log.do_package.12543
ERROR: Task (/home/vbalestero/df63ng/df63ng-imx6-bsp-287/build/workspace/recipes/express/ failed with exit code '1'

I read at some forums that creating npm recipes was not working perfectly with older Yocto releases than the most recent one (Dunfell). Is that correct ?

Help will be appreciated.

Hi @vbalestero,

Sorry for the delay in answering you.

Did you manage to solve this issue?

If not, please, provide me the following details:

  • What is the content of your conf/bblayers.conf file?
  • What is the configuration of your conf/local.conf file?

And, if you allow me, I’d like to propose you to move ahead of your BSP.
You are using BSP 2.8.7, which is still supported, but we strongly recommend to use BSP 3.0.4, which is the latest LTS BSP we have for the moment.

Best regards,
André Curvello

Thanks @andrecurvello.tx.

I’ve already fixed it using another method, now I can cross-compile npm packages and deploy it to our device.
Now I’ve to found out at how to deploy it inside our custom BSP image.

About switching to new BSP 3.0.4, we could not do that because ou device is already fully tested with BSP 2.8b4. But thanks again.

Hi @vbalestero,

I’m glad to hear that it’s working now.

About the method, I’m a little bit curious. Could you share what you did?

About the BSP, I’d recommend you to move to the BSP 2.8b7, then, because it’s the latest update of the BSP 2.8 we have. BSP 2.8b4 is no longer supported.

Best regards,
André Curvello

Hi @andrecurvello.tx,

Sorry I forget to explain that I’m already using the BSP 2.8.7, and I’m using the method listed here from yocto’s manual.

I stopped using this method because I didn’t understand what was going on about the error message below.:

NOTE: sqlite3: compiling from external source tree /home/vbalestero/df63ng/df63ng-imx6-bsp-287/build/workspace/sources/sqlite3
ERROR: sqlite3-5.0.0-r0 do_packagedata: QA Issue: Package version for package sqlite3-dbg went backwards which would break package feeds from (3:3.20.0-r0 to 0:5.0.0-r0) [version-going-backwards]
ERROR: sqlite3-5.0.0-r0 do_packagedata: QA Issue: Package version for package sqlite3 went backwards which would break package feeds from (3:3.20.0-r0 to 0:5.0.0-r0) [version-going-backwards]

After some headaches, I could figure out whats going on.

The error is about SQLITE3 database and NODE-SQLITE3 recipes names, when , and could not change the recipe name for NODE-SQLITE3 because it gave many others errors.

So, my idea was to compile my image with the SQLITE3 server before, and then remove it from my configuration in order to compile NODE-SQLITE3 using the method shown in the yocto manual and deploy it to my device.

I know that this method does not solve my problem at all, because I need both in my image.

I tried to create a recipe to SQLITE3 server using another recipe name but it does not worked, it gave many errors too.

I’ll be glad if you have some idea how to fix it.

Hi @vbalestero,

Have you modified directly the recipes directories of the sqlite3? Changed its SRC or something like that…?

The messages show that the package version has changed from its reference, that’s why Yocto is complaining about it.

So you may have to adjust the repo reference of sqlite3.

Please have a look at this material Yocto QA Warnings

Best regards,

André Curvello