You can use the devtool add
command two
different ways to add Node.js modules: 1) Through
npm
and, 2) from a repository or local
source.
Use the following form to add Node.js modules through
npm
:
$ devtool add "npm://registry.npmjs.org;name=forever;version=0.15.1"
The name and version parameters are mandatory. Lockdown and shrinkwrap files are generated and pointed to by the recipe in order to freeze the version that is fetched for the dependencies according to the first time. This also saves checksums that are verified on future fetches. Together, these behaviors ensure the reproducibility and integrity of the build.
You must use quotes around the URL.
The devtool add
does not require
the quotes, but the shell considers ";" as a splitter
between multiple commands.
Thus, without the quotes,
devtool add
does not receive the
other parts, which results in several "command not
found" errors.
In order to support adding Node.js modules, a
nodejs
recipe must be part
of your SDK.
As mentioned earlier, you can also add Node.js modules
directly from a repository or local source tree.
To add modules this way, use devtool add
in the following form:
$ devtool add https://github.com/diversario/node-ssdp
In this example, devtool
fetches the
specified Git repository, detects the code as Node.js
code, fetches dependencies using npm
, and
sets
SRC_URI
accordingly.