Troubleshooting
Why a Node-RED node recipe builds but is missing from the image
Short answer
A clean bitbake log proves only that the recipe's tasks ran. The package must still be selected into the image through IMAGE_INSTALL, and Node-RED must find the module under the directories its runtime searches. With no errors and no module, open the package file list and the image recipe before touching npm flags; with an error, fix the named task first.

On this page
- A build delivers three results, and a clean log proves one
- Sort the symptom before touching the recipe
- Read the task log that exists
- The silent case: clean logs, empty node_modules
- One class, many recipes: nodedir and shared flags
- Prepare the shrinkwrap on matching versions
- Working the reported build: eight recipes, three outcomes
- What the corrected recipes changed
- The decision for each case
- Questions asked
Your recipe ran to the end, bitbake reported no error, and the node is still absent from node_modules on the device. That is not an npm failure, and no npm flag will fix it. A build has to deliver three separate results: the recipe's tasks complete, the finished package is selected into the image through IMAGE_INSTALL, and the Node-RED runtime finds the module under the directories it searches. A clean log with an empty node_modules proves only the first result, which puts the fault in packaging or image selection. Here is how to sort your case in one pass, where the real task logs live, and the decision for each outcome.
A build delivers three results, and a clean log proves one #
Result one is task completion. The layer's npm class drives the fetch, compile and install steps for a node recipe, and a packaging task assembles the installable package. Each task writes its own log, so completion is something you read, not something you infer.
Result two is image selection. A recipe can sit under recipes-app in the meta-iot2050 tree and build perfectly, and the device still never receives it, because a package reaches an image only when the image recipe lists it in IMAGE_INSTALL. In the reported build that meant editing iot2050-image-example.bb under recipes-core/images to add each node package name.
Result three is runtime discovery. Node-RED scans the nodes directory under userDir and any additional directories named in its runtime configuration; a module outside those directories never appears in the palette. One early workaround pre-generated a .node-red/packages.json to get preinstalled nodes recognized; after the layer fixes described below, that file was no longer needed.
Sort the symptom before touching the recipe #
Every missing node lands in exactly one of three classes, and the class decides the first file you open:
- A task log ends in an error: a real build failure. Open the log for the failing task,
log.do_installorlog.do_dpkg_buildin the reported cases, and fix that task. No selection or discovery change repairs an install that never completed. - Every task log is clean and the module is absent from node_modules: a packaging or image-selection problem. Open the package file list next, then the image recipe.
- The module is on the device and the palette still lacks it: a discovery problem. If it is the S7 nodes that vanish at runtime, that side is covered in why S7 nodes disappear from the Node-RED palette.
One reported build produced controls, task failures and a silent case side by side. Treat its table as symptoms to sort, not as compatibility results:
| Recipe (reported version) | Reported outcome | Class |
|---|---|---|
| node-red-node-ui-table 0.3.1 | Installed and worked | Control recipe |
| node-red-node-ui-led 0.3.1 | Installed and worked | Control recipe |
| @mindconnect/node-red-contrib-mindconnect 3.7.0 | Installed and worked | Control, scoped name |
| node-red-contrib-s7 2.1.1 | Built clean, module absent from node_modules | Packaging or selection |
| node-red-contrib-opcua 0.2.58 | Failed during packaging | Task failure: log.do_dpkg_build |
| node-red-contrib-modbus 5.12.0 | Failed during install | Task failure: log.do_install |
| node-red-node-sqlite 0.4.3 | Failed to build, like the others | Task failure: read the log |
| node-red-dashboard 2.22.1 | Reported ambiguously | Read the task status first |
Read the task log that exists #
Each task writes its log into the temp folder of the recipe's work directory, named after the task with the run's process number appended; the reported failures surfaced as log.do_install.193 for the Modbus recipe and log.do_dpkg_build.1338 for the OPC UA recipe.
Read for the first error, not the last line. The final line often says only that the task failed; the first error names the operation and the file, command or dependency that broke. do_install is where the npm install places files into the package's staging tree, so an install-stage failure points at dependency resolution or install scripts. The packaging task is where the installable package gets assembled, and that is where the OPC UA recipe died: the reported cause was a prebuilt x86 binary inside the package, a packaging defect rather than an npm problem.
The silent case: clean logs, empty node_modules #
This is the S7 pattern from the reported build: tasks complete, the device boots, the palette never shows the node. Work the checks in order and stop at the first one that fails:
- Confirm every task log for the recipe is clean. One overlooked error line moves the case back to the previous section.
- List the contents of the built package. If the module directory is missing from the packaged file list, the recipe's install step or file selection is wrong; fix the recipe and rebuild.
- If the package carries the files, open the image recipe you actually built and confirm the package name sits in
IMAGE_INSTALL. A recipe underrecipes-appcontributes nothing to an image until that line selects it. - If the image carries the files, confirm the install destination is a directory the runtime searches, the nodes directory under
userDiror one added in the runtime configuration. A module installed elsewhere is built, shipped and invisible. - Reflash a bench unit and prove the node appears in the palette there before the image goes to the line.
One class, many recipes: nodedir and shared flags #
Every node recipe inherits the layer's npm class, classes/npm.bbclass in the reported tree, so a class edit hits all of them. That gives you a fork: when every node fails after a shared change, revert the change and investigate the class; when one node fails, compare that recipe's dependencies, install scripts and binary content, and leave the class alone. The class is enough of a pressure point that issue 135 on the predecessor layer's tracker discusses replacing npm with pnpm inside it.
The class also held a broken nodedir setting. That setting points native-module compilation at Node.js headers; pointed wrong, the build hunts for missing or incompatible headers and native modules fail even though dependency retrieval succeeded. The layer's fix removed the setting, but as part of one broader repair that also corrected the ported recipes and the OPC UA packaging, so deleting a line from an old class does not reproduce the fixed branch. Take the corrected class and recipes together.
The reported workaround threaded ADD_FLAGS="--unsafe-perm --no-audit" through the class. Neither flag changes an install destination or selects a package into an image, so neither can move a module into node_modules.
Native parts must also match the target processor: a module compiled for the wrong architecture fails at load time even when packaging succeeded, the same rule that applies when rebuilding Node-RED serialport modules on a 32-bit ARM edge PC.
Prepare the shrinkwrap on matching versions #
A new recipe needs npm-shrinkwrap.json, and that file records resolved dependency versions: it steers resolution, it does not replace fetching and installing the packages it lists. Generate it the way the reported procedure did:
- Boot a device running the same Node.js and Node-RED versions the image build uses, and note the npm version and target architecture alongside.
- Start from an empty folder, install only the package you want, and keep just the generated shrinkwrap; a used folder drags unrelated dependencies into the lockfile.
- Compare the device's Node.js and Node-RED versions against the image before trusting the tree, and resolve any mismatch first.
Copying a prepared node_modules tree instead is legitimate only when the packaging design consumes a prepared tree, and its compiled parts belong to the machine that built them, so verify runtime and architecture compatibility separately from the shrinkwrap.
Working the reported build: eight recipes, three outcomes #
Inputs, all from the reported build list:
- 8 node recipes attempted.
- 3 installed and worked: the ui-table, ui-led and scoped mindconnect packages.
- 4 failed to build or install: the OPC UA package (error in
log.do_dpkg_build), the Modbus package (error inlog.do_install), and the sqlite and dashboard packages (reported failing like the others, the dashboard description ambiguous). - 1 built with a clean log: the S7 package, module absent from node_modules.
Rule: each recipe belongs to the first of the three results it fails, that is task completion, image selection or runtime discovery, so counting outcomes tells you which fault family you hold before you open a single file.
Arithmetic: 8 attempted − 3 working − 4 task failures = 1 silent case.
Result: exactly one recipe, the S7 node at version 2.1.1, sits in the silent class; four need task-log work; three are untouched controls.
Decision: a log with at least one error line sends that recipe to the task fix, where no discovery change helps, and the ambiguous dashboard recipe starts at its task log too, because an unclear report is not a clean log. A clean log with zero module files under node_modules sends the recipe to the package file list, then IMAGE_INSTALL. One silent case out of eight, with three siblings built fine by the same class, also exonerates the shared class: the S7 fault is in its own recipe or its selection.
What the corrected recipes changed #
The layer's development branch resolved this exact situation: it fixed the ported recipes, removed the broken nodedir setting from the npm class, addressed the OPC UA package's included x86 binary, and after those changes the pre-generated .node-red/packages.json was no longer required. Build on that state instead of re-patching an older class; the full path from the kas descriptor to custom firmware is walked in generating custom IOT2050 firmware with meta-iot2050.
You also have working controls for free: the meta-node-red layer lists node-red-gpio, node-red-node-serialport and node-red-node-sqlite as pre-installed nodes, so a maintained recipe for a package like sqlite already exists upstream; compare a failing hand-written recipe against the shipped one before writing anything new. On the OPC UA side, the alternative node-red-contrib-iiot-opcua package is reported as deprecated on the registry, so the corrected node-red-contrib-opcua recipe is the workable path for this image. If OPC UA nodes go missing after a palette install rather than an image build, that is a different fault, covered in why OPC UA nodes are missing from the Node-RED palette.
The decision for each case #
- An error ends
log.do_installorlog.do_dpkg_build: it is a build failure. Fix the named task; for the OPC UA package, take the corrected recipe that handles the included x86 binary. Do not touchIMAGE_INSTALL, discovery settings or npm flags, because none of them reach a task that never completed. - Clean logs and an empty node_modules: packaging or selection. Open the package file list first; files missing means the recipe's install step, files present means the
IMAGE_INSTALLline of the image recipe you actually built. - Files on the device, node not in the palette: discovery. Confirm the install location is among the directories the runtime searches, then work the runtime side.
- Every node failing after a shared class edit: revert and read the class,
nodedirincluded. One node failing while three siblings work: the fault is that recipe or its selection, and the working controls prove the class is fine.
Questions asked
What do --unsafe-perm and --no-audit actually do during the build?
Neither reaches your symptom. --no-audit only skips npm's audit step, so the log shows no vulnerability report; --unsafe-perm only changes permission handling for install scripts when the build runs with elevated rights. A module that is missing after a clean build stays missing with either flag added, which is why threading them through the npm class rescued none of the failing recipes.
Why does an included x86 binary break the OPC UA package build?
The IOT2050 target runs on ARM processors, and the reported package carried a prebuilt x86 binary that cannot execute there; the packaging task failed on it. The repair belongs in the recipe: native parts must be compiled for the target, or the foreign binary must stay out of the packaged files. Whenever a node ships prebuilt modules, check which processor architecture they were compiled for before the package goes into an image.
Should nodes be baked into the image or installed from the palette later?
Bake the standard set into the image: every unit then boots with identical nodes and keeps them across a reflash, at the cost of one rebuild per change. Palette installs suit trials on a single device; they land under the user directory and must be repeated and tracked unit by unit. A workable split is one image recipe carrying the standard node set, with experiments kept off the image.
Why is a pre-generated packages.json no longer needed?
The old procedure shipped a hand-made packages.json under the .node-red user directory so the preinstalled nodes were picked up. With the ported recipes fixed and the broken nodedir setting removed, the corrected recipes put nodes where the runtime's discovery already looks, so the hand-made list is redundant. Leave it out of new builds: a stale copy describes a package set that no longer matches the image.
How do scoped package names affect the recipe?
A scope adds a directory level: the scoped mindconnect package installs under a scope folder inside node_modules, so both the recipe name and the packaged file list must reflect that path. In the reported build the scoped package was among the ones that installed and worked, which makes its recipe the control to copy when another scoped package fails to appear.

