Node-RED service not restarting on RPI 1 after adding module to palette

I am trying to install NodeRed on my RPI 1 under DietPi. When I install it, I get the following error message.
Despite this error, Node-RED seems to start normally and can be invoked via the web interface.

DietPi-Software
─────────────────────────────────────────────────────
 Mode: Installing Node-RED: tool for wiring devices, APIs and online services

[  OK  ] DietPi-Software | mkdir -p /mnt/dietpi_userdata/node-red
[  OK  ] DietPi-Software | Verifying user "nodered" to run Node-RED
[  OK  ] DietPi-Software | useradd -rMU -G gpio,i2c -d /mnt/dietpi_userdata/node-red -s /usr/sbin/nologin nodered
[  OK  ] DietPi-Software | chown -R nodered:nodered /mnt/dietpi_userdata/node-red
[ INFO ] DietPi-Software | APT install for: python3, please wait...
[  OK  ] DietPi-Software | APT install for: python3
[  OK  ] DietPi-Software | cd /mnt/dietpi_userdata/node-red
[ INFO ] DietPi-Software | sudo -u nodered npm i --no-audit node-red, please wait...
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated node-pre-gyp@0.12.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

> bcrypt@3.0.6 install /mnt/dietpi_userdata/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v67-linux-arm-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@11.15.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 5.10.17+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/mnt/dietpi_userdata/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/mnt/dietpi_userdata/node-red/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /mnt/dietpi_userdata/node-red/node_modules/bcrypt
gyp ERR! node -v v11.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/mnt/dietpi_userdata/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/mnt/dietpi_userdata/node-red/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/mnt/dietpi_userdata/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:193:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:999:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
node-pre-gyp ERR! System Linux 5.10.17+
node-pre-gyp ERR! command "/usr/local/bin/node" "/mnt/dietpi_userdata/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /mnt/dietpi_userdata/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v11.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/mnt/dietpi_userdata/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/mnt/dietpi_userdata/node-red/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)

> bcrypt@3.0.8 install /mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.8/bcrypt_lib-v3.0.8-node-v67-linux-arm-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.8 and node@11.15.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 5.10.17+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt
gyp ERR! node -v v11.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:193:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:999:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
node-pre-gyp ERR! System Linux 5.10.17+
node-pre-gyp ERR! command "/usr/local/bin/node" "/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt
node-pre-gyp ERR! node -v v11.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/mnt/dietpi_userdata/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
npm WARN saveError ENOENT: no such file or directory, open '/mnt/dietpi_userdata/node-red/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/mnt/dietpi_userdata/node-red/package.json'
npm WARN ws@7.4.5 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.4.5 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN node-red No description
npm WARN node-red No repository field.
npm WARN node-red No README data
npm WARN node-red No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.8 (node_modules/node-red-admin/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.8 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ node-red@1.3.5
added 302 packages from 279 contributors in 307.971s

The real problem occurs as soon as I try to install an extension of the Node-RED palette like the dashboard or an InfluxDB integration via the interface. After a few seconds of installation, the page simply crashes. The service can not be restarted afterwards, there comes the following message after the command dietpi-services status node-red:

 DietPi-Services
─────────────────────────────────────────────────────
 Mode: status node-red

[FAILED] DietPi-Services | ● node-red.service - Node-RED (DietPi)
   Loaded: loaded (/etc/systemd/system/node-red.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2021-05-22 18:34:02 CEST; 32s ago
  Process: 687 ExecStart=/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red -u /mnt/dietpi_userdata/node-red (code=exited, status=203/EXEC)
 Main PID: 687 (code=exited, status=203/EXEC)

May 22 18:34:02 rpi-smarthome-hub systemd[1]: Started Node-RED (DietPi).
May 22 18:34:02 rpi-smarthome-hub systemd[687]: node-red.service: Failed to execute command: No such file or directory
May 22 18:34:02 rpi-smarthome-hub systemd[687]: node-red.service: Failed at step EXEC spawning /mnt/dietpi_userdata/node-red/node_modules/.bin/node-red: No such file or directory
May 22 18:34:02 rpi-smarthome-hub systemd[1]: node-red.service: Main process exited, code=exited, status=203/EXEC
May 22 18:34:02 rpi-smarthome-hub systemd[1]: node-red.service: Failed with result 'exit-code'.

In the logs under journalctl -u node-red there is no additional information, only the same message as in the status command. Also a new installation has not changed anything :cry:

How can I repair Node-RED again?

Hi,

you are missing Node-Red executable.

/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red: No such file or directory

Did you tried to reinstall ?

dietpi-software reinstall 122

During the reinstallation I got exactly the same errors as during the actual installation, but Node-RED could be started successfully and I could install new modules. The missing file is now also available. So Node-RED seems to work again for now.

Thanks for your support!