Cannot install NodeRed with additional package?

I am attempting to add the node red node

node-red-contrib-i2c

And am attempting to do so like this.

But results in the following error. Am I doing something wrong?

Thanks

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting

-----------------------------------------------------------
 Add-on: Node-RED
 Flow-based programming for the Internet of Things
-----------------------------------------------------------
 Add-on version: 17.0.12
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 12 (bookworm)  (armv7 / raspberrypi4)
 Home Assistant Core: 2024.4.3
 Home Assistant Supervisor: 2024.04.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-nginx: starting
s6-rc: info: service init-customizations: starting
[09:17:48] INFO: Starting installation of custom NPM/Node-RED packages...
s6-rc: info: service init-nginx successfully started
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config 
npm WARN config     Default value does install optional deps unless otherwise omitted.
npm WARN config only Use `--omit=dev` to omit dev dependencies from the install.
npm notice 
npm notice New patch version of npm available! 10.5.0 -> 10.5.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
npm ERR! code 1
npm ERR! path /opt/node_modules/i2c-bus
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | arm
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - executable path is ""
npm ERR! gyp ERR! find Python - "" could not be run
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - executable path is ""
npm ERR! gyp ERR! find Python - "" could not be run
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:306:11)
npm ERR! gyp ERR! stack at PythonFinder.findPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:164:17)
npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR! gyp ERR! stack at async configure (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:23:18)
npm ERR! gyp ERR! stack at async run (/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js:81:18)
npm ERR! gyp ERR! System Linux 6.1.0-rpi7-rpi-v8
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /opt/node_modules/i2c-bus
npm ERR! gyp ERR! node -v v18.20.2
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-16T21_17_49_557Z-debug-0.log
[09:17:57] FATAL: Failed to install a specified npm package
s6-rc: warning: unable to start service init-customizations: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service init-nginx: stopping
s6-rc: info: service init-nginx successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

I have not done anything like this myself, however I have read of some of the consequences of trying to add additional modules to Node-RED using the configuration settings.

Node-RED as an addon for Home Assistant is specially packaged as executable code only, and does not include python and the make modules that are required to compile and build additional code to an executable package.

The solution, apparently, is to include a bunch of any necessary system packages as well as the module you want.

https://github.com/hassio-addons/addon-node-red/blob/15b43f1bf3d16376972504f6663ba9190d293e54/node-red/DOCS.md#option-system_packages

I believe that make, gcc, g++ are typically also required.

I can’t provide a definitive list, but hope that this reference I found offers some help for you.

https://github.com/hobbyquaker/node-red-contrib-lgtv/issues/62

1 Like

I actually just ended up firing up a independent and separate docker container running node-red and this has solved the issue for me.

I have the same problem where I can’t properly control what Node-RED does when it’s installed using the add-on. And everything is fine when I run Node-RED on a different machine (my local Mac). BUT I don’t know enough about how to run this on the same machine as my Home Assistant OS on Yellow. I’ve only played a bit with Docker, and not at all with the OS. Any pointers when using Home Assistant OS?

In my latest problem using the add-on, it appears as though the add-on is trying to run my build script in my package.json, which uses tsc. I can’t figure out why it would be executing npm run build. I don’t see anything weird in my package.json file.