Troubleshooting
Node-RED will not start after an npm update on an IOT2040
Short answer
On a gateway still running Node.js v6.14.3, a blanket npm update installs a Node-RED release that needs Node.js 8 or newer, so the autostart entry loads nothing. Confirm the runtime with node -v, then reinstall the last compatible release, Node-RED 0.19.5, using npm's global install pinned to that version. Fix npm download failures first; a re-image removes the mismatch but not the runtime ceiling.

On this page
A blanket module update is the fastest way to take a Node-RED gateway offline: it pulls in the newest release, and that release expects a newer Node.js than the box runs. On the reported IOT2040, still on Node.js v6.14.3, the update to 0.20.8 completed and the gateway then refused to start, printing a notice that the Node.js version is unsupported. The autostart entry is not the fault, and retrying cannot fix it. The recovery is a pinned reinstall of 0.19.5, the last release verified against that runtime, once npm's network path is confirmed. What follows separates the two failure modes — a download failure and a runtime mismatch — because their fixes differ, and ends with the decision for each case.
Sort the two failures before you touch anything #
An update can fail in two unrelated places, and the fix that helps one wastes time on the other. Read which one you have before changing anything:
- Download failure. npm exits with an error before anything is installed: an unreachable registry, a failed name lookup, a proxy rejection. The old Node-RED still runs, and nothing about versions is wrong yet.
- Runtime mismatch. The download and install complete, and the next start prints a notice that the Node.js version is unsupported and recommends the latest LTS release. On the reported gateway, that notice is where startup ended and the editor never came up.
The autostart checkbox plays no part in either case. Autostart launches whatever the node-red command resolves to; if that release cannot run on the installed Node.js, the entry fails on every boot no matter how often it is re-enabled.
Rule out the network path first #
Fix the path first, because no version decision can even be tested without it. On an IOT2040, the Ethernet port labeled X2 is configured for DHCP by default, and a Wi-Fi USB dongle is the other reported route in; either way, npm needs a working default gateway and DNS. An unreachable-registry error usually means the connection or a missing default gateway — with DHCP the lease should set it — not anything inside Node-RED. A successful ping alone does not prove npm's path, because the registry needs DNS and a route as well. When a download fails, npm leaves a timestamped debug log under .npm/_logs in the home directory, for example /home/root/.npm/_logs/2022-02-07T09_06_45_772Z-debug.log, and its last lines name the real cause.
Two look-alikes have their own pages: a failure on the name lookup is DNS, not a dead gateway, as in Node-RED getaddrinfo EAI_AGAIN means DNS, not internet; and on a plant network that reaches the internet through a proxy, npm fails with E502 until the proxy is configured, as in Fix npm E502 when installing Node-RED nodes behind a proxy.
Match the release to the runtime #
The Node-RED project's versions FAQ documents the minimum Node.js per release line and currently recommends Node 24.x. The numbers that drive this decision, with their source:
| Node-RED line | Minimum Node.js | Verdict on the Node.js 6 runtime |
|---|---|---|
| 0.19.5 | 6 — reported tested on exactly this pairing | Recovery target |
| After 0.19.5, including 0.20.x and 1.x | 8 or newer (reported) | Blocked by the unsupported-version notice |
| 2.x | 12 (versions FAQ) | Blocked |
| 3.x | 14 (versions FAQ) | Blocked |
| 4.x | 18 (versions FAQ) | Blocked |
| 5.x | 22 (versions FAQ) | Blocked |
Read the reported values as field observations from the update case and the FAQ values as the project's documented minimums.
Recovering an IOT2040 that runs Node.js v6.14.3 #
Inputs. Runtime: node -v returns v6.14.3, the value reported on the affected device; confirm yours the same way. Installed release: 0.20.8, pulled in by the blanket update. Network: the install completed, so the download path works and needs no troubleshooting here.
Rule. A release starts only when the installed Node.js meets the minimum that release declares. Walk the declared minimums from the newest line to the oldest and stop at the newest release the runtime satisfies, preferring a pairing someone has tested.
Arithmetic. The runtime's major version is 6. Compare it down the table: 6 is below 22, below 18, below 14, below 12, and below 8, so every release after 0.19.5 fails the check and the whole documented 2.x-to-5.x range fails with it. The next step down the ladder is 0.19.5, whose own requirement is the 6 the runtime already has.
Result. Reinstall that release globally — the -g flag makes the command independent of the directory you run it from:
npm install -g --unsafe-perm node-red@0.19.5
Keep --unsafe-perm as one option; split into two words it becomes an option npm does not know, and the install stops. Start Node-RED through the device's existing autostart entry, which needs no change, and confirm the editor loads without the unsupported-version notice.
Decision. Pin 0.19.5 and stop: with the runtime at major version 6, no newer release passes the walk, and an unpinned update re-breaks the gateway on its next run. Had node -v returned 12, the same walk would stop at the 2.x line; on 14, at 3.x.
Re-image only as a reset, not an upgrade #
A re-image is worth doing after a broken update because it restores the supplied stack and clears any half-installed packages — but run node -v when it finishes, because the re-image does not move the compatibility ceiling. On the reported device, the last Node.js build that ever ran on it needed a device-specific patch, and respondents state the device line is no longer supported; no image, therefore, produces a runtime that the documented 2.x-and-newer lines accept. That is also why the two ceiling reports differ: one gateway settled on 1.3.7 and another on 1.3.5, both on patched Node.js 8 builds.
Treat those as observations from particular images, not as a compatibility boundary, and do not use either as a target on an unpatched Node.js 6 image — there, the verified recovery release remains the ceiling. Keep a copy of the last known-good image before the next change, so a failed update costs a restore rather than a rebuild.
The decision for each case #
- npm fails before anything installs — an unreachable registry, a name-lookup failure, a proxy rejection: repair the path (the DHCP lease and default gateway on X2, DNS, or the proxy), then repeat the pinned command. No version decision applies yet.
- npm succeeds and the unsupported-version notice appears: the release is beyond the runtime. On a Node.js 6 runtime the answer is the recovery release, installed pinned, and never updated unpinned. One caution: that release line receives no security maintenance, so the gateway stays inside the OT segment with no direct route to the internet until the runtime moves.
- The update-everything habit: replace it with explicit, pinned, one-package-at-a-time installs, and record the working versions in the gateway's notes. Stable Node-RED gateway flows with vendor-pinned nodes shows the pattern to follow.
- A crash instead of a clean refusal — if a node install leaves the runtime crashing rather than refusing to start, Node-RED crashes after a node install: safe mode and rollback is the recovery path.
- A re-image after a broken update: legitimate as a reset, and pin the recovery release again immediately afterwards; the re-image does not raise the ceiling.
- Current Node-RED lines required — anything from the 2.x minimum of Node.js 12 upward: the decision is hardware, not configuration. Move the flows to an industrial mini PC running a supported Node.js LTS and reinstall Node-RED and the nodes there.
Questions asked
How can I confirm which Node-RED version the device is running after the recovery?
The startup log prints the release when Node-RED launches, before any flow loads, so read it from the device console or its service log. From the shell, npm list -g node-red also reports the installed package version. Check it after the pinned install and after every future update, before declaring the gateway back in service.
Can the pinned install be done on a gateway with no internet access?
Yes, but stage it instead of improvising. Copy the release package onto the device and install from that file; npm still tries to fetch the package's dependencies unless they come along, so build the full set on a connected machine first and transfer it together. The offline path is easy to half-complete, and a half-complete install fails at startup just like the one described above.
Does npm not check the Node.js version before installing an update?
npm treats a package's declared engine range as advisory by default, so a blanket update takes the newest published release even when the runtime cannot execute it. The check that matters happens when Node-RED starts, not when npm downloads. That is why the fix is an explicit version pin, and why repeating the same update command reproduces the same failure.
Is the pinned recovery a permanent answer?
No. The release line you pin stopped receiving maintenance years ago, so the pin restores service, not support. Use it to hold a stable gateway while you plan the real fix: hardware that runs a maintained Node.js LTS, onto which the same flows and nodes reinstall unchanged. Budget for that move instead of letting the pinned state quietly become permanent.


