[yocto] npm nodejs

Stefan Herbrechtsmeier stefan at herbrechtsmeier.net
Wed Aug 21 12:24:57 PDT 2019


Hi Jonas,

Am 21.08.19 um 14:55 schrieb Jonas Andersson:
> I have used Yocto and npm/nodejs now for about 1 year and think it works 
> but I not without some extra work. Are there any group working on 
> npm/nodejs? As I use it quite frequent and puts some extra work every 
> time i create an recipe I have some interest in supporting the work on 
> npm/nodejs to make it an better experience.
> 
> I thinks It quite hard to follow all the npm/nodejs parts of 
> Yocto(devtool, fetcher and meta-oe/../nodejs), I get the feeling that 
> all parts not are in sync.

I have start reworking the nodejs support but haven't the time to finish it.

I have remove the use of the bitbake npm fetcher. I create a recipe per 
npm package major version. Thereby the recipe downloads the npm archive 
via https, extract it to /usr/lib/node_modules/name-major and creates 
links for the dependency packages and binaries. This avoids duplicated 
npm packages and allows a per package optimization like the remove of 
scripts, tests and documentations. Furthermore I can patch npm packages 
to use dynamic linking or build native packages.

I have add a new plugin to the recipetool which creates a recipe from a 
npm package. It extract the license, dependencies and binaries from the 
package.json. Thereby the dependencies string is parsed and translated 
into a <package name>-<major version> or <package name>-0.<minor 
version> if major version is below 0. I assume that I can ignore the 
minor and patch version number and always use the latest compatible version.

On top of recipetool I have a script with creates a recipe for a npm 
package and all its dependencies.


Regards
   Stefan


More information about the yocto mailing list