OpenEmbedded layer for latest Node.js releases.
ℹ️ As an official extension of this layer, installing meta-nodejs-contrib
is highly recommended for community contributed Node.js based package recipes and Bitbake helper classes.
meta-nodejs
depends on following layers:
Node.js v7 ships with V8 v5.5 that requires native (host) compilation of additional build tools (mkpeephole
, mksnapshot
).
Building these tools for 32-bit targets (e.g. Arm) also requires 32-bit native toolchain.
In this case, following package should be installed in the build host:
g++-multilib
nodejs
nodejs-npm
nodejs-dtrace
nodejs-systemtap
nodejs-wafadmin
(only with Node.js0.8
)
Layer installation varies depending on your OpenEmbedded distribution. These instructions are generic.
-
Fetch
meta-nodejs
layer fromhttps://github.com/imyller/meta-nodejs.git
-
Add
meta-nodejs
layer toEXTRALAYERS
inconf/bblayers.conf
. For example:EXTRALAYERS +=" \ ${TOPDIR}/sources/meta-nodejs \ "
As an official extension of this layer, installing meta-nodejs-contrib
is highly recommended for community contributed Node.js based package recipes and Bitbake helper classes.
To build latest stable Node.js package:
bitbake nodejs
Add Node.js as a dependency in recipe with RDEPENDS
(for runtime) or DEPENDS
(for build):
DEPENDS += " nodejs"
RDEPENDS_${PN} += " nodejs"
Inherit npm-install
build task class in your recipe.
meta-nodejs
layer adds few Node.js related helper classes.
npm-base
class defines following functions:
oe_runnpm
: call cross-compilingnpm
oe_runnpm_native
: call native-compilingnpm
For example:
inherit npm-base
do_install() {
oe_runnpm install # Installs dependencies defined in package.json
}
NPM_FLAGS
: Extra command line arguments fornpm
calls made byoe_runnpm()
NPM_ARCH
: Override npm target architecture (defaults toTARGET_ARCH
)NPM_REGISTRY
: override npm registry URL
npm-install
class inherits npm-base
class and adds following build tasks (listed in their run order):
npm_install
: runsnpm install
in source directorynpm_shrinkwrap
: runsnpm shrinkwrap
in source directorynpm_dedupe
: runsnpm dedupe
in 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"
NPM_INSTALL_FLAGS
: Extra command line arguments fornpm
calls made innpm_install
taskNPM_INSTALL
: Parameters fornpm install
command (such as specific package names)
npm-install-global
class inherits npm-base
class and installs the selected package globally.
This is done in the do_install
task of the class.
NPM_INSTALL_FLAGS
: Extra command line arguments fornpm
calls made indo_install
anddo_configure
task