Describe the problem/error/question
Hi guys!
Me and my colleagues are having hard time setting up the python libraries which can be used with the code node in our workflows.
We are using Docker on the Ubuntu machine.
The docker-compose.yml, task-runners.json and Dockerfile are already set up by my colleauge who used only HTTP request nodes. He did not use the code node with custom Python/JS libraries.
Locally on my PC, I installed Docker desktop, set up the docker-compose.yml, task-runners.json and Dockerfile and everything worked fine. When I tried to reproduce that on the production I got the errors. I will paste the errors below.
First we tried setting up the pdf-lib JS library, then we tried setting up the pypdf library.
Could you please help us resolve the issue.
How can we set up custom JS/Python libraries?
What are the best practices (regarding the containers setup) if multiple users are going to create workflows in n8n?
What is the error message (if any)?
Error message in terminal: root@n8nsvrp01:~/n8n-docker# sudo docker compose up -d --build task-runners
WARN[0000] Docker Compose is configured to build using Bake, but buildx isn’t installed
[+] Building 0.8s (7/7) FINISHED docker:default
=> [task-runners internal] load build definition from runner.Dockerfile 0.0s
=> => transferring dockerfile: 399B 0.0s
=> [task-runners internal] load metadata for Docker Hub Container Image Library | App Containerization 0.5s
=> [task-runners internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [task-runners 1/4] FROM Docker Hub Container Image Library | App Containerization 0.0s
=> => resolve Docker Hub Container Image Library | App Containerization 0.0s
=> CACHED [task-runners 2/4] WORKDIR /build 0.0s
=> CACHED [task-runners 3/4] RUN npm init -y && npm install pdf-lib 0.0s
=> ERROR [task-runners 4/4] RUN cd /opt/runners/task-runner-python && VIRTUAL_ENV=/opt/runners/task-runner-python/.venv uv pip install --python /opt/runners/task-runner-python/.venv/bin/python pypdf && chown -R runner 0.2s
[task-runners 4/4] RUN cd /opt/runners/task-runner-python && VIRTUAL_ENV=/opt/runners/task-runner-python/.venv uv pip install --python /opt/runners/task-runner-python/.venv/bin/python pypdf && chown -R runner /opt/runners/task-runner-python/.venv:
0.183 /bin/sh: cd: line 0: can’t cd to /opt/runners/task-runner-python: No such file or directory
failed to solve: process “/bin/sh -c cd /opt/runners/task-runner-python && VIRTUAL_ENV=/opt/runners/task-runner-python/.venv uv pip install --python /opt/runners/task-runner-python/.venv/bin/python pypdf && chown -R runner /opt/runners/task-runner-python/.venv” did not complete successfully: exit code: 2
Please share your workflow
Share the output returned by the last node
Cannot find module ‘pako’ Require stack: - /opt/runners/task-runner-javascript/node_modules/@pdf-lib/standard-fonts/lib/utils.js - /opt/runners/task-runner-javascript/node_modules/@pdf-lib/standard-fonts/lib/Font.js - /opt/runners/task-runner-javascript/node_modules/@pdf-lib/standard-fonts/lib/index.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/utils/objects.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/utils/index.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/core/errors.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/core/index.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/objects.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/operators.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/colors.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/operations.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/form/appearances.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/form/index.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/api/index.js - /opt/runners/task-runner-javascript/node_modules/pdf-lib/cjs/index.js - /opt/runners/task-runner-javascript/dist/js-task-runner/require-resolver.js - /opt/runners/task-runner-javascript/dist/js-task-runner/js-task-runner.js - /opt/runners/task-runner-javascript/dist/start.js
Information on your n8n setup
- n8n version: 2.17.8.
- Database (default: SQLite): Postgre:15
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu 26.04