Describe the problem
When I enabled N8N_RUNNERS_ENABLED=true
for n8n and installed the http-proxy-agent
library, I encountered an error related to module import.
Does anyone know how to fix this, or could you please help me?
What is the error message (if any)?
swift
Sao chépChỉnh sửa
[Task Runner]: Task runner failed to start {
error: SyntaxError: The requested module 'http-cookie-agent/http' does not provide an export named 'HttpCookieAgent'
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:376:37)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:323:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)
at Module._compile (node:internal/modules/cjs/loader:1511:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1572:16)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1096:12)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at require (node:internal/modules/helpers:182:18)
at JsTaskRunner.preventPrototypePollution (/usr/local/lib/node_modules/n8n/node_modules/@n8n/task-runner/dist/js-task-runner/js-task-runner.js:86:17)
}
Information on your n8n setup
- n8n version: 1.89.2
- Database (default: SQLite): (default)
- n8n EXECUTIONS_PROCESS setting (default: own, main): runners
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker (self-hosted)
- Operating system: Linux (Docker container)
Hello @Hung_Hoang
Below is a suggestion to help you with your problem.
This error may occur due to an incompatible version of the http-cookie-agent library
As a test, install a specific version of the library
npm install http-proxy-agent@^7.0.0 http-cookie-agent@^5.0.4
Have you tried clearing the Node.js cache??
npm cache clean --force
Try reinstalling the dependencies
rm -rf node_modules
npm install
Check the compatibility with your version of n8n, here is the link to the documentation that talks about the versions - Release notes | n8n Docs
Remember to DEPLOY your VPS instance
I hope I helped in some way.
If this suggestion solved your problem, please mark my post as the solution (blue box with check mark) so that this ongoing discussion does not distract others who want to find out the answer to the original question and click the heart. Thank you 
Thank you very much for your valuable help. I will proceed to test it and will keep you updated if there are any further developments. Much appreciated!
I have experimented with installing specific versions of http-proxy-agent but still get the error.
Dockerfile file details:
“”"
FROM n8nio/n8n:latest
USER root
RUN apk update && apk add --no-cache dpkg curl bash
RUN apk update && apk add --no-cache python3 py3-pip make g++ \
&& rm -rf /var/cache/apk/*
RUN npm cache clean --force
RUN rm -rf node_modules
RUN npm install -g uuid axios buffer aws4 axios-cookiejar-support http-proxy-agent@^5.0.0 tough-cookie
USER node
“”"
Details of docker-compose.yml file:
“”"
version: “3.7”
services:
postgres:
image: postgres:16
ports:
- “0.0.0.0:5432:5432”
restart: always
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_NON_ROOT_USER
- POSTGRES_NON_ROOT_PASSWORD
volumes:
- db_storage:/var/lib/postgresql/data
- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
healthcheck:
test: [‘CMD-SHELL’, ‘pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}’]
interval: 5s
timeout: 5s
retries: 10
n8n:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- “5678:5678”
environment:
- N8N_HOST=${VPN_IP}
- N8N_PORT=5678
- N8N_SECURE_COOKIE=false
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_DEFAULT_BINARY_DATa_MODE=TRUE
- N8N_BASIC_AUTH_USER=${AUTH_USER}
- N8N_BASIC_AUTH_PASSWORD=${AUTH_PASS}
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
- N8N_METRICS=true
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=${N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS}
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
- N8N_EMAIL_MODE=smtp
- N8N_SMTP_HOST=${SMTP_HOST}
- N8N_SMTP_PORT=${SMTP_PORT}
- N8N_SMTP_USER=${SMTP_USER}
- N8N_SMTP_PASS=${SMTP_PASS}
- N8N_SMTP_SENDER=${SMTP_SENDER}
- N8N_SMTP_SSL=false
- N8N_RUNNERS_ENABLED=true
- N8N_RUNNERS_MODE=internal
- NODE_FUNCTION_ALLOW_BUILTIN=*
- N8N_ENABLE_NODEJS_MODULES=true
- NODE_FUNCTION_ALLOW_EXTERNAL=uuid,axios,buffer,aws4,axios-cookiejar-support,http-proxy-agent,tough-cookie
volumes:
- n8n_data:/home/node/.n8n
- /local-files:/files
- /home/hcm57/data/cookie_account_tiktok:/data/cookie_account
- /home/hcm57/data/list_key_word.txt:/data/list_key_word.txt
links:
- postgres
depends_on:
postgres:
condition: service_healthy
signature-browser:
restart: always
build:
context: ./tiktok-signature-browser
container_name: signature-browser
ports:
- “3000:3000”
working_dir: /app
environment:
- NODE_ENV=production
volumes:
n8n_data:
external: false
db_storage:
“”"