Then I think the dependency to canvas is a problem. I have not developed custom nodes with dependencies yet but I know some which need a custom docker deployment with the dependencies installed.
I am currently on the road. So I have no chance to validate it, though.
I’ve just activated the log and set the level to debug, but the message is not really helpful:
{"level":"error","message":"InternalServerError: Error loading package \"@disane-dev/n8n-nodes-text-to-image\" :The npm package \"@disane-dev/n8n-nodes-text-to-image\" could not be found.","metadata":{"file":"LoggerProxy.js","function":"exports.error","timestamp":"2023-11-12T17:44:08.135Z"}}
@nico-kow I guess you are right with the node-canvas dependency. I now to install my node via console in my docker and I got this error:
npm ERR! code 1
npm ERR! path /home/node/.n8n/nodes/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! 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 --update-binary --module=/home/node/.n8n/nodes/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/node/.n8n/nodes/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108’ (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | linux | x64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-musl-x64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-musl-x64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, musl) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-linux-musl-x64.tar.gz
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 | x64
npm ERR! gyp info ok
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 | x64
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 - “python3” is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if “python” can be used
npm ERR! gyp ERR! find Python - “python” is not in PATH or produced an error
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 GitHub - nodejs/node-gyp: Node.js native addon build tool
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:330:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
npm ERR! gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
npm ERR! gyp ERR! stack at exithandler (node:child_process:430:5)
npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:442:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:477:16)
npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Linux 5.19.17-Unraid
npm ERR! 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” “–update-binary” “–module=/home/node/.n8n/nodes/node_modules/canvas/build/Release/canvas.node” “–module_name=canvas” “–module_path=/home/node/.n8n/nodes/node_modules/canvas/build/Release” “–napi_version=9” “–node_abi_napi=napi” “–napi_build_version=0” “–node_napi_label=node-v108”
npm ERR! gyp ERR! cwd /home/node/.n8n/nodes/node_modules/canvas
npm ERR! gyp ERR! node -v v18.18.2
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! 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 --update-binary --module=/home/node/.n8n/nodes/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/node/.n8n/nodes/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108’ (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (/home/node/.n8n/nodes/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Linux 5.19.17-Unraid
npm ERR! node-pre-gyp ERR! command “/usr/local/bin/node” “/home/node/.n8n/nodes/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build” “–update-binary”
npm ERR! node-pre-gyp ERR! cwd /home/node/.n8n/nodes/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v18.18.2
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2023-11-13T07_13_02_225Z-debug-0.log
Too bad that the error message is pretty broad and doesn’t really help in that particular case
Looks like node-canvas doesn’t have pre-built binaries for Alpine (linux-musl), so NPM wants to compile a binary from source, but the build dependencies aren’t available in the docker image.
I’d recommend either creating a custom docker image following the suggestions here, or creating a custom image using debian instead of alpine linux as the base.