@shakthipsg Try this change and let me know your outcome I will explain after if working.
const path = require('path');
// Common environment variables for all instances
const sharedEnv = {
// Database Config
DB_TYPE: "postgresdb",
DB_POSTGRESDB_HOST: "localhost",
DB_POSTGRESDB_PORT: "5432",
DB_POSTGRESDB_DATABASE: "n8n_db",
DB_POSTGRESDB_USER: "n8n_user",
DB_POSTGRESDB_PASSWORD: "n8n",
DB_POSTGRESDB_SCHEMA: "n8n",
N8N_ENCRYPTION_KEY: "*****", // Replace with your actual key
// Redis / Queue Config
EXECUTIONS_MODE: "queue",
QUEUE_BULL_REDIS_HOST: "localhost",
QUEUE_BULL_REDIS_PORT: "6379",
// General Config
N8N_LOG_LEVEL: "info",
N8N_LOG_OUTPUT: "console",
N8N_BLOCK_ENV_ACCESS_IN_NODE: "false",
N8N_MIGRATE_FS_STORAGE_PATH: "true",
N8N_ENDPOINT: "http://localhost:5678",
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS: "true",
// Runner/Broker Config (CRITICAL)
N8N_RUNNERS_ENABLED: "true",
N8N_RUNNERS_MODE: "internal",
N8N_RUNNERS_BROKER_PORT: "5679" // This is the ONLY port the broker uses
};
// Windows path to n8n binary (Note the double backslashes)
const n8nPath = "C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\n8n\\bin\\n8n";
module.exports = {
apps: [
{
name: "n8n-main",
script: n8nPath,
args: "start",
interpreter: "node",
env: {
...sharedEnv
}
},
// Generate 5 Workers
...[1, 2, 3, 4, 5].map((i) => ({
name: `n8n-worker-0${i}`,
script: n8nPath,
args: "worker --concurrency 50",
interpreter: "node",
env: {
...sharedEnv,
// All workers connect to the SINGLE broker port hosted by Main
N8N_RUNNERS_TASK_BROKER_URI: "127.0.0.1:5679"
}
}))
]
};
** Remember - you must perform pm2 delete n8n before loading this new configuration in order to prevent ghosts from generating.
In JavaScript strings, a single backslash (\) is an escape character. If you use C:\Users, the \U will break the script. I have used double backslashes (\\) in the config above to ensure Windows understands the path.
if there is still error please share output of n8n-error.log
Not able to upload the log files. Here is the latest trace from logs.
worker-1:
n8n Task Broker ready on 127.0.0.1, port 5679
Failed to start Python task runner in internal mode. because Python 3 is missing from this system. Launching a Python runner in internal mode is intended only for debugging and is not recommended for production. Users are encouraged to deploy in external mode. See: Task runners | n8n Docs
There is a deprecation related to your environment variables. Please take the recommended actions to update your configuration:
N8N_RUNNERS_ENABLED → Remove this environment variable; it is no longer needed.
[license SDK] Skipping renewal on init: renewOnInit is disabled in config
[license SDK] Skipping renewal on init: autoRenewEnabled is disabled in config
[license SDK] Skipping renewal on init: license cert is not due for renewal
All other workers:
Out file has only the below trace.
”””
n8n Task Broker’s port 5679 is already in use. Do you have another instance of n8n running already?
”””
Delete all the process, logs files, and started fresh. Only 1 worker came online. No traces in error logs. Out logs has only the below trace for failed workers.
”””
n8n Task Broker’s port 5679 is already in use. Do you have another instance of n8n running already?
”””