OpenEmbedded layer for latest stable Node.js releases.
-
Add
meta-nodejslayer tosources/layers.txtmeta-nodejs,git://github.com/imyller/meta-nodejs.git,master,HEAD -
Add
meta-nodejslayer toEXTRALAYERSinconf/bblayers.confEXTRALAYERS +=" \ ${TOPDIR}/sources/meta-nodejs \ " -
Run
oebb.sh update
- To build latest stable Node.js package:
bitbake nodejs
Add Node.js as a dependency in recipe:
RDEPENDS_${PN} += "nodejs"
Inherit npm or npm-install build task classes in your recipe.
meta-nodejs layer adds two new classes: npm and npm-install.
npm defines the oe_runnpm command which will call cross-compiling npm.
For example:
inherit npm
do_install() {
oe_runnpm install # Installs dependencies defined in package.json from in source directory to node_modules
}
You can define extra command line arguments for npm calls made by oe_runnpm() by appending them to NPM_FLAGS variable.
npm-install class inherits npm class and adds following build tasks (listed in their run order):
npm_install: runsnpm installin source directorynpm_shrinkwrap: runsnpm shrinkwrapin source directorynpm_dedupe: runsnpm dedupein source directory
You can disable one or more of these build tasks in the recipe with do_<taskname>[noexec] = "1":
do_npm_shrinkwrap[noexec] = "1"
-
You can define extra command line arguments for
npmcommand by appending them toNPM_INSTALL_FLAGSvariable. -
you can define parameters for
npm installcommand (such as specific package names) by appending them toNPM_INSTALLvariable.