Issue with Running n8n in Docker Compose: "env: can't execute 'node': No such file or directory"

I’ve been trying to set up n8n using Docker Compose by building my custom image, but I’ve encountered the error:

2025-01-06 17:59:18 env: can't execute 'node': No such file or directory

This error occurs when trying to run n8n after building the Docker image from a custom Dockerfile located in the ./docker/images/n8n-custom/ folder.

My docker-compose.yml

Here’s the configuration I’m using:

services:
  n8n:
    build:
      context: .
      dockerfile: ./docker/images/n8n-custom/Dockerfile
    container_name: n8n
    ports:
      - "5678:5678"
    environment:
      - DB_TYPE=mysqldb
      - DB_MYSQLDB_HOST=mysql_db
      - DB_MYSQLDB_PORT=3306
      - DB_MYSQLDB_DATABASE=mysql_db
      - DB_MYSQLDB_USER=root
      - DB_MYSQLDB_PASSWORD=******
      - N8N_PORT=5678
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=*****
      - N8N_BASIC_AUTH_PASSWORD=*****
      - WEBHOOK_URL=http://localhost:5678
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false
    volumes:
      - n8n_data:/home/node/.n8n
    restart: unless-stopped
    depends_on:
      mysql_db:
        condition: service_healthy

  mysql_db:
    container_name: mysql_db
    image: mysql/mysql-server:8.0
    command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    environment:
      MYSQL_DATABASE: mysql_db
      MYSQL_ROOT_PASSWORD: ******
      MYSQL_ROOT_HOST: "%"
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
      interval: 10s
      timeout: 5s
      retries: 3

volumes:
  n8n_data:
    driver: local
  mysql_data:
    driver: local

The Error

When I build and run this Docker Compose setup, the n8n container fails to execute the node binary and throws the following error:

env: can't execute 'node': No such file or directory
  • n8n version: 1.73.1
  • Database (default: SQLite): mysql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 11

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.