# Build from source for n8n monorepo # Stage 1: builder - compile the project from source FROM node:24-alpine AS builder # Install build tools RUN apk add --no-cache python3 make g++ git # Install the required package manager RUN npm i -g pnpm@10.22.0 WORKDIR /app # First copy only manifest files to leverage Docker cache during install COPY package.json pnpm-workspace.yaml turbo.json* ./ # Install dependencies for the entire workspace RUN pnpm install # Then copy the rest of the source COPY . . # Build the project from source RUN pnpm build # Stage 2: runtime image FROM node:24-alpine # Create a non-root user to run the app RUN addgroup -S n8n && adduser -S -G n8n n8n WORKDIR /home/n8n # Copy built artifacts from the builder COPY --from=builder /app /home/n8n/app # Environment settings ENV NODE_ENV=production # Expose the standard n8n port EXPOSE 5678 # Use the non-root user to run the application USER n8n # The entrypoint starts the n8n CLI server CMD ["node", "/home/n8n/app/packages/cli/bin/n8n"]
# Repro specific build ignore list .git node_modules **/node_modules logs *.log dist build coverage .vscode .env *.tsbuildinfo .DS_Store *.pem .npmrc .yarnrc pnpm-lock.yaml package-lock.json .cache .tmp """
Failing step - [builder 6/8] RUN pnpm install Exact error message and exit code - ENOENT ENOENT: no such file or directory, open '/app/patches/bull@4.16.4.patch' - pnpm: ENOENT: no such file or directory, open '/app/patches/bull@4.16.4.patch' - ERROR: process "/bin/sh -c pnpm install" did not complete successfully: exit code: 254 Missing packages/files mentioned - Missing file: /app/patches/bull@4.16.4.patch Version mismatch / context notes - Base image: node:24-alpine - pnpm version: 10.22.0 (update available to 10.32.1) - npm notice: New minor version available: 11.9.0 → 11.12.0 Additional context - Working directory at failure: /app (as set by WORKDIR /app in the Dockerfile) - The failure arises during dependency installation for the workspace via pnpm, caused by the missing patch file.
# Build from source for n8n monorepo # Stage 1: builder - compile the project from source FROM node:24-alpine AS builder # Install build tools RUN apk add --no-cache python3 make g++ git # Install the required package manager RUN npm i -g pnpm@10.22.0 WORKDIR /app # First copy only manifest files to leverage Docker cache during install COPY package.json pnpm-workspace.yaml turbo.json* ./ # Include patches directory required for pnpm patch files COPY patches ./patches # Install dependencies for the entire workspace RUN pnpm install # Then copy the rest of the source COPY . . # Build the project from source RUN pnpm build # Stage 2: runtime image FROM node:24-alpine # Create a non-root user to run the app RUN addgroup -S n8n && adduser -S -G n8n n8n WORKDIR /home/n8n # Copy built artifacts from the builder COPY --from=builder /app /home/n8n/app # Ensure proper ownership for the runtime user RUN chown -R n8n:n8n /home/n8n/app # Environment settings ENV NODE_ENV=production # Expose the standard n8n port EXPOSE 5678 # Use the non-root user to run the application USER n8n # The entrypoint starts the n8n CLI server CMD ["node", "/home/n8n/app/packages/cli/bin/n8n"]
Summary (under 1500 chars): - Failing step: [builder 7/9] RUN pnpm install (as shown in Dockerfile: RUN pnpm install) - Exact error message and exit code: - Command failed: process "/bin/sh -c pnpm install" did not complete successfully: exit code: 1 - ERR_PNPM_WORKSPACE_PKG_NOT_FOUND: In : "@n8n/eslint-config@workspace:*" is in the dependencies but no package named "@n8n/eslint-config" is present in the workspace - This error happened while installing a direct dependency of /app - Packages found in the workspace: - Missing packages or files mentioned: - The workspace is missing the package named "@n8n/eslint-config" referenced by "@n8n/eslint-config@workspace:*" - Version mismatch / update info: - Update available! 10.22.0 → 10.32.1 (pnpm) - Changelog: https://pnpm.io/v/10.32.1 - To update, run: pnpm add -g pnpm Notes: - The error occurs during the workspace install step of the Docker build, blocking the image construction.
# Build from source for n8n monorepo # Stage 1: builder - compile the project from source FROM node:24-alpine AS builder # Install build tools RUN apk add --no-cache python3 make g++ git # Install the required package manager RUN npm i -g pnpm@10.22.0 WORKDIR /app # Copy the entire repository to build from source COPY . . # Install dependencies for the entire workspace RUN pnpm install # Build the project from source RUN pnpm build # Stage 2: runtime image FROM node:24-alpine # Create a non-root user to run the app RUN addgroup -S n8n && adduser -S -G n8n n8n WORKDIR /home/n8n # Copy built artifacts from the builder COPY --from=builder /app /home/n8n/app # Ensure proper ownership for the runtime user RUN chown -R n8n:n8n /home/n8n/app # Environment settings ENV NODE_ENV=production # Expose the standard n8n port EXPOSE 5678 # Use the non-root user to run the application USER n8n # The entrypoint starts the n8n CLI server CMD ["node", "/home/n8n/app/packages/cli/bin/n8n"]
Summary: - Exact error message and exit code - ERROR: failed to build: failed to solve: process "/bin/sh -c pnpm install" did not complete successfully: exit code: 1 - 126.5 ERR_PNPM_UNUSED_PATCH The following patches were not used: @types/express-serve-static-core@5.0.6, vue-tsc@2.2.8 - 126.5 Either remove them from "patchedDependencies" or update them to match packages in your dependencies. - Failing command/step - [builder 6/7] RUN pnpm install (Dockerfile line: 18) - Missing packages or files mentioned - None explicitly mentioned. The error relates to unused patches rather than missing dependencies/files. - Version mismatch info - Update available! 10.22.0 → 10.32.1 (pnpm update notice during install) - The failure is due to patchedDependencies patches not matching current dependencies (patches not used).
# Build from source for n8n monorepo # Stage 1: builder - compile the project from source FROM node:24-alpine AS builder # Install build tools RUN apk add --no-cache python3 make g++ git # Install the required package manager RUN npm i -g pnpm@10.22.0 WORKDIR /app # Copy only manifest files to leverage Docker caching and avoid patch-related issues COPY package.json pnpm-workspace.yaml turbo.json* ./ # Install dependencies for the entire workspace (patches not included yet to avoid unused patch issues) RUN pnpm install # Now copy the rest of the repository including patches COPY . . # Build the project from source RUN pnpm build # Stage 2: runtime image FROM node:24-alpine # Create a non-root user to run the app RUN addgroup -S n8n && adduser -S -G n8n n8n WORKDIR /home/n8n # Copy built artifacts from the builder COPY --from=builder /app /home/n8n/app # Ensure proper ownership for the runtime user RUN chown -R n8n:n8n /home/n8n/app # Environment settings ENV NODE_ENV=production # Expose the standard n8n port EXPOSE 5678 # Use the non-root user to run the application USER n8n # The entrypoint starts the n8n CLI server CMD ["node", "/home/n8n/app/packages/cli/bin/n8n"]
- Failing step: [builder 6/8] RUN pnpm install - Exact error message and exit code: - ERROR: failed to build: failed to solve: process "/bin/sh -c pnpm install" did not complete successfully: exit code: 254 - Missing packages or files mentioned: - ENOENT: no such file or directory, open '/app/patches/bull@4.16.4.patch' - pnpm: ENOENT: no such file or directory, open '/app/patches/bull@4.16.4.patch' - Missing file: /app/patches/bull@4.16.4.patch - Version mismatch / update notice: - Update available! 10.22.0 → 10.32.1. - Context note: - The Dockerfile mentions patches are not included yet to avoid unused patch issues, but the patch file is required during pnpm install.
# Build from source for n8n monorepo # Stage 1: builder - compile the project from source FROM node:24-alpine AS builder # Install build tools RUN apk add --no-cache python3 make g++ git # Install the required package manager RUN npm i -g pnpm@10.22.0 WORKDIR /app # Copy manifest files first to leverage Docker cache COPY package.json pnpm-workspace.yaml turbo.json* ./ # Copy patches to enable patched dependencies during install COPY patches ./patches # Install dependencies for the entire workspace RUN pnpm install # Copy the rest of the repository COPY . . # Build the project from source RUN pnpm build # Stage 2: runtime image FROM node:24-alpine # Create a non-root user to run the app RUN addgroup -S n8n && adduser -S -G n8n n8n WORKDIR /home/n8n # Copy built artifacts from the builder COPY --from=builder /app /home/n8n/app # Ensure proper ownership for the runtime user RUN chown -R n8n:n8n /home/n8n/app # Environment settings ENV NODE_ENV=production # Expose the standard n8n port EXPOSE 5678 # Use the non-root user to run the application USER n8n # The entrypoint starts the n8n CLI server CMD ["node", "/home/n8n/app/packages/cli/bin/n8n"]
Summary (under 1500 chars): - Failing step: [builder 7/9] RUN pnpm install (Dockerfile:21) - Exact error message and exit code: ERR_PNPM_WORKSPACE_PKG_NOT_FOUND In : "@n8n/eslint-config@workspace:*" is in the dependencies but no package named "@n8n/eslint-config" is present in the workspace This error happened while installing a direct dependency of /app Packages found in the workspace: Exit code: 1 Process "/bin/sh -c pnpm install" did not complete successfully: exit code: 1 - Missing packages or files mentioned: - The workspace depends on "@n8n/eslint-config@workspace:*" but no package named "@n8n/eslint-config" is present in the workspace. - Version mismatch info: - PNPM version attempted: pnpm@10.22.0 (global install in builder step) - Base image: node:24-alpine - No explicit version mismatch reported beyond the PNPM installation shown.
# Build from source for n8n monorepo (using prebuilt compiled artifacts when available)
ARG NODE_VERSION=24.13.1
# Stage 1: builder - reuse prebuilt node_modules if available
FROM node:${NODE_VERSION}-alpine AS builder
# If there is a prebuilt compiled folder, copy it into the image; otherwise this stage is a no-op for dependencies
COPY ./compiled /usr/local/lib/node_modules/n8n
# Rebuild native addons in case needed
RUN if [ -d /usr/local/lib/node_modules/n8n ]; then \
npm rebuild sqlite3 isolated-vm; \
fi
# Stage 2: runtime image using the shared base image
FROM n8nio/base:${NODE_VERSION}
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts from the builder if present
COPY --from=builder /usr/local/lib/node_modules/n8n /usr/local/lib/node_modules/n8n
# Copy entrypoint script from repo
COPY docker/images/n8n/docker-entrypoint.sh /docker-entrypoint.sh
# Ensure binary is available and permissions are correct
RUN if [ -d /usr/local/lib/node_modules/n8n ]; then \
ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n; \
fi && \
mkdir -p /home/node/.n8n && \
chown -R node:node /home/node && \
rm -rf /root/.npm /tmp/*
EXPOSE 5678/tcp
# Use the non-root user to run the application
USER node
# The entrypoint starts the n8n CLI server
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
LABEL org.opencontainers.image.title="n8n" \
org.opencontainers.image.description="Workflow Automation Tool" \
org.opencontainers.image.source="https://github.com/n8n-io/n8n" \
org.opencontainers.image.url="https://n8n.io" \
org.opencontainers.image.version=${N8N_VERSION}
ARG NODE_VERSION=24
# Builder stage: install dependencies and build the monorepo
FROM node:${NODE_VERSION}-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install pnpm and fetch dependencies
RUN npm i -g pnpm@10.22.0
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy source and build the project
COPY . .
RUN pnpm build
# Runtime stage
FROM node:${NODE_VERSION}-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy node_modules and built CLI from the builder
COPY --from=builder /workspace/node_modules /home/node/app/node_modules
COPY --from=builder /workspace/packages/cli/bin/n8n /home/node/app/packages/cli/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled || true
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli || true
# Make the n8n binary executable and expose CLI on PATH
RUN ln -s /home/node/app/packages/cli/bin/n8n /usr/local/bin/n8n || true
RUN chmod +x /home/node/app/packages/cli/bin/n8n || true
# Ensure proper permissions for non-root user
RUN mkdir -p /home/node/.n8n \
&& chown -R node:node /home/node
# Expose the web UI port
EXPOSE 5678/tcp
USER node
# Default command to start n8n
CMD ["n8n"]
# Use a stable Node base image for reproducible builds
ARG NODE_VERSION=24
FROM node:24-alpine AS builder
# Install required build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install a reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install dependencies for the monorepo
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy the entire repository and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy node_modules (n8n uses native addons for performance)
COPY --from=builder /workspace/node_modules /usr/local/lib/node_modules/n8n
# Copy the n8n CLI binary and ensure it is in PATH
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
# Optionally expose built artifacts if present
COPY --from=builder /workspace/compiled /home/node/app/compiled || true
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli || true
# Make sure the binary is executable and available on PATH
RUN chmod +x /usr/local/bin/n8n
# Ensure proper permissions for non-root user
RUN mkdir -p /home/node/.n8n \
&& chown -R node:node /home/node
EXPOSE 5678/tcp
USER node
# Default command to run n8n
CMD ["n8n"]
# Exclude heavy tooling and caches from the build context node_modules/ **/node_modules/ dist/ build/ coverage/ *.log *.tmp *.tsbuildinfo .env .vscode/ .git/ .github/ .DS_Store # Include patches and source needed for build !.dockerignore
# Exclude heavy tooling and caches from the build context node_modules/ **/node_modules/ dist/ build/ coverage/ *.log *.tmp *.tsbuildinfo .env .vscode/ .git/ .github/ .DS_Store # Include patches and source needed for build !.dockerignore
Concerns: No Dockerfile found at repo root
ARG NODE_VERSION=24
FROM node:${NODE_VERSION}-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install dependencies first for caching
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy entire repo and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:${NODE_VERSION}-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules /home/node/node_modules
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
COPY --from=builder /workspace/compiled /home/node/app/compiled || true
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install dependencies first for caching
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy entire repo and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules /usr/local/lib/node_modules/n8n
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled || true
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli || true
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
node_modules/ **/node_modules/ dist/ build/ coverage/ *.log *.tmp *.tsbuildinfo .env .vscode/ .git/ .github/ .DS_Store """
#!/bin/sh set -e exec "$@"
ARG NODE_VERSION=24
FROM dhi.io/node:${NODE_VERSION}-alpine3.22-dev
ARG NODE_VERSION
# Install fonts and dependencies
RUN apk add --no-cache git openssh openssl bash tzdata
WORKDIR /home/node
ENV NODE_PATH=/opt/nodejs/node-v${NODE_VERSION}/lib/node_modules
EXPOSE 5678/tcp
ARG NODE_VERSION=24
FROM node:24-alpine AS base
ARG NODE_VERSION
# Install fonts and dependencies
RUN apk add --no-cache git openssh openssl bash tzdata
WORKDIR /home/node
ENV NODE_PATH=/opt/nodejs/node-v${NODE_VERSION}/lib/node_modules
EXPOSE 5678/tcp
node_modules/ **/node_modules/ dist/ build/ coverage/ *.log *.tmp *.tsbuildinfo .env .vscode/ .git/ .github/ .DS_Store
Concerns: COPY --from=builder /workspace/node_modules /usr/local/lib/node_modules/n8n nests the entire node_modules directory under /usr/local/lib/node_modules/n8n, which will place dependencies at /usr/local/lib/node_modules/n8n/node_modules/... instead of the expected /usr/local/lib/node_modules/n8n/...; this is likely to break module resolution for the n8n package., Relying on copying /workspace/node_modules instead of /workspace/node_modules/n8n is a structural issue that can cause runtime failures., || true on the copy of compiled and cli may hide missing artifacts; image could build even if build artifacts are not produced, leading to a non-functional runtime.
FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install dependencies first for caching
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy entire repo and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules/n8n /usr/local/lib/node_modules/n8n
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
Summary of Docker build error - Failing step: - [builder 6/8] RUN pnpm install --frozen-lockfile - Exact error messages and exit code: - 1.210 ERR_PNPM_CATALOG_IN_OVERRIDES Could not resolve a catalog in the overrides: No catalog entry '@sentry/node' was found for catalog 'sentry'. - ERROR: process "/bin/sh -c pnpm install --frozen-lockfile" did not complete successfully: exit code: 1 - Missing packages or files mentioned: - No catalog entry '@sentry/node' was found for catalog 'sentry' (PNPM overrides catalog missing this entry) - Version mismatch / related notices: - Update available! 10.22.0 → 10.32.1 (Changelog: https://pnpm.io/v/10.32.1) - The build displayed: “npm notice New minor version of npm available! 11.9.0 -> 11.12.0” and the command was using pnpm@10.22.0 (installed earlier with RUN npm i -g pnpm@10.22.0) - Context note: - The error occurs during dependency installation with PNPM due to a catalog override referencing @sentry/node that PNPM cannot resolve.
FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.32.0
# Copy entire repo and build
COPY . .
# Install dependencies (allow fallback if lockfile is missing)
RUN pnpm install --frozen-lockfile || pnpm install
# Build the project
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules/n8n /usr/local/lib/node_modules/n8n
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
- Failing step/command: [builder 6/7] RUN pnpm install --frozen-lockfile || pnpm install - Exact error messages and exit code: WARN Failed to create bin at /workspace/packages/testing/playwright/node_modules/.bin/playwright-janitor. ENOENT: no such file or directory, open '/workspace/packages/testing/janitor/dist/cli.js' ELIFECYCLE Command failed with exit code 1. - Missing packages/files mentioned: Missing file: /workspace/packages/testing/janitor/dist/cli.js (ENOENT indicates the file was not found during bin creation) - Version information observed: npm notice New minor version of npm available! 11.9.0 -> 11.12.0 npm notice To update run: npm install -g npm@11.12.0 Notes: - The build failed during the pnpm install step due to a missing file that prevents creating the expected bin for Playwright janitor. The exit code reported is 1.
FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install dependencies (excluding problematic testing package to avoid Playwright bin issues)
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --filter '!./packages/testing' || true
# Copy entire repo and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules /usr/local/lib/node_modules/n8n
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
Failing step: - [builder 8/8] RUN pnpm build Exact error message and exit code: - sh: turbo: not found - Exit code: 1 - Additionally observed: ELIFECYCLE Command failed. Command/step that failed: - pnpm build (in the container's builder stage) Missing packages/files / issues mentioned: - turbo: not found (causing the build to fail) - No projects matched the filters "/workspace/packages/testing" in "/workspace" - ERR_PNPM_CATALOG_IN_OVERRIDES Could not resolve a catalog in the overrides: No catalog entry '@sentry/node' was found for catalog 'sentry'. - WARN Local package.json exists, but node_modules missing, did you mean to install? Version/mismatch information: - Update available! 10.22.0 → 10.32.1. (pnpm update banner) Summary line: The build fails at the final step RUN pnpm build due to turbo not being available, with related pnpm install warnings about missing node_modules and catalog override issues (@sentry/node), including a matching filter error and a pnpm update notice. Exit code: 1.
FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager and turbo
RUN npm i -g pnpm@10.22.0
RUN npm i -g turbo@2.9.0
# Install dependencies for the monorepo
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy the repository and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules /home/node/node_modules
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
Exact error message and exit code - ERROR: failed to build: failed to solve: process "/bin/sh -c npm i -g turbo@2.9.0" did not complete successfully: exit code: 1 Failing command/step - [builder 5/9] RUN npm i -g turbo@2.9.0 Missing packages or files mentioned - No matching version found for turbo@2.9.0. - A complete log of this run can be found in: /root/.npm/_logs/2026-03-23T19_57_07_744Z-debug-0.log Version mismatch info - turbo@2.9.0 does not exist in the npm registry (no matching version found), causing the ETARGET/notarget error. Context notes - Dockerfile indicates the line performing the install is installing turbo@2.9.0 at line 10 (Dockerfile:10).
FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install turbo (default to latest compatible)
RUN npm i -g turbo
# Install dependencies for the monorepo
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy the repository and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules /home/node/node_modules
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
Error summary:
- Failing command/step: [builder 7/9] RUN pnpm install --frozen-lockfile (Dockerfile:16)
- Exit code: 1
- Exact error message snippet:
- "1.599 ╭──────────────────────────────────────────╮
1.599 │ │
1.599 │ Update available! 10.22.0 → 10.32.1. │
1.599 │ Changelog: https://pnpm.io/v/10.32.1 │
1.599 │ To update, run: pnpm add -g pnpm │
1.599 ╰──────────────────────────────────────────╯
1.599
1.668 ERR_PNPM_CATALOG_IN_OVERRIDES Could not resolve a catalog in the overrides: No catalog entry '@sentry/node' was found for catalog 'sentry'."
- Missing packages/files mentioned:
- No catalog entry '@sentry/node' was found for catalog 'sentry' (PNPM overrides) — i.e., a required package/catalog entry is missing.
- Version mismatch / related info:
- "Update available! 10.22.0 → 10.32.1. Changelog: https://pnpm.io/v/10.32.1. To update, run: pnpm add -g pnpm"FROM node:24-alpine AS builder
# Install build tools
RUN apk add --no-cache python3 make g++ git bash openssl
WORKDIR /workspace
# Install reproducible package manager
RUN npm i -g pnpm@10.22.0
# Install turbo (default to latest compatible)
RUN npm i -g turbo
# Install dependencies for the monorepo
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy the repository and build
COPY . .
RUN pnpm build
# Runtime stage
FROM node:24-alpine AS runtime
ARG N8N_VERSION
ARG N8N_RELEASE_TYPE=dev
ENV NODE_ENV=production
ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
ENV SHELL=/bin/sh
WORKDIR /home/node
# Copy built artifacts and CLI binary from builder
COPY --from=builder /workspace/node_modules /home/node/node_modules
COPY --from=builder /workspace/packages/cli/bin/n8n /usr/local/bin/n8n
COPY --from=builder /workspace/compiled /home/node/app/compiled
COPY --from=builder /workspace/packages/cli /home/node/app/packages/cli
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node
EXPOSE 5678
USER node
CMD ["n8n"]
# Multistage Dockerfile to build n8n from source and run from the built artifacts
# Stage 1: builder - build from source using Node.js and pnpm
FROM node:24-alpine AS builder
# Install build dependencies and enable corepack for pnpm
RUN apk add --no-cache python3 make g++ bash curl && \
corepack enable && \
corepack prepare pnpm@latest --activate
WORKDIR /workspace
# Copy manifests first to leverage build cache
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
# Install dependencies (monorepo)
RUN pnpm install --frozen-lockfile
# Copy the rest of the repository
COPY . .
# Build the n8n distribution from source
RUN pnpm build:n8n
# Stage 2: runtime - run the built n8n from the compiled output
FROM node:24-alpine
# Install lightweight runtime tools
RUN apk add --no-cache tini curl
WORKDIR /home/node
# Copy the prebuilt artifacts from the builder
COPY --from=builder /workspace/compiled /usr/local/lib/node_modules/n8n
# Prepare entrypoint
COPY docker/images/n8n/docker-entrypoint.sh /docker-entrypoint.sh
RUN ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
mkdir -p /home/node/.n8n && \
chown -R node:node /home/node
EXPOSE 5678
USER node
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s CMD curl -fsS http://localhost:5678/health || exit 1
# Docker build context optimizations node_modules/ dist/ compiled/ coverage/ *.log *.tmp .env* .git/ .gitignore .idea/ .vscode/ .DS_Store npm-debug.log pnpm-debug.log
Failing step - Builder stage: [builder 5/7] RUN pnpm install --frozen-lockfile (Dockerfile:17) Exact error message and exit code - ERROR: process "/bin/sh -c pnpm install --frozen-lockfile" did not complete successfully: exit code: 254 - ENOENT errors during patch file access: - 1.829 ENOENT ENOENT: no such file or directory, open '/workspace/patches/pkce-challenge@5.0.0.patch' - 1.829 pnpm: ENOENT: no such file or directory, open '/workspace/patches/pkce-challenge@5.0.0.patch' Missing packages or files mentioned - Missing file: /workspace/patches/pkce-challenge@5.0.0.patch Version information / mismatches - Base image: node:24-alpine - Corepack/pnpm: pnpm-10.22.0 (pnpm is being prepared/activated via Corepack; PNPM log shows preparing pnpm@latest and downloading pnpm-10.22.0.tgz) - No explicit version mismatch stated beyond the PNPM/Corepack initialization; failure is due to the missing patch file referenced in the workspace.
# Multistage Dockerfile to build n8n from source and run from the built artifacts
# Stage 1: builder - build from source using Node.js and pnpm
FROM node:24-alpine AS builder
# Install build dependencies and enable corepack for pnpm
RUN apk add --no-cache python3 make g++ bash curl && \
corepack enable && \
corepack prepare pnpm@latest --activate
WORKDIR /workspace
# Copy patches (if any) to satisfy pnpm patch application
COPY patches /workspace/patches
# Copy manifests first to leverage build cache
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
# Install dependencies (monorepo)
RUN pnpm install --frozen-lockfile
# Copy the rest of the repository
COPY . .
# Build the n8n distribution from source
RUN pnpm build:n8n
# Stage 2: runtime - run the built n8n from the compiled output
FROM node:24-alpine
# Install lightweight runtime tools
RUN apk add --no-cache tini curl
WORKDIR /home/node
# Copy the prebuilt artifacts from the builder
COPY --from=builder /workspace/compiled /usr/local/lib/node_modules/n8n
# Prepare entrypoint
COPY docker/images/n8n/docker-entrypoint.sh /docker-entrypoint.sh
RUN ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
mkdir -p /home/node/.n8n && \
chown -R node:node /home/node
EXPOSE 5678
USER node
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s CMD curl -fsS http://localhost:5678/health || exit 1
- Failing step: [builder 6/8] RUN pnpm install --frozen-lockfile - Exact error message and exit code: - Error: Cannot find module '/workspace/scripts/block-npm-install.js' - Code: MODULE_NOT_FOUND - Node.js v24.14.0 - Exit code: 1 - Related log snippet: ". preinstall: Error: Cannot find module '/workspace/scripts/block-npm-install.js'" and "ELIFECYCLE Command failed with exit code 1." - Missing packages or files mentioned: - Missing file: /workspace/scripts/block-npm-install.js - Version mismatch / notices: - PNPM update suggestion shown: “Update available! 10.22.0 → 10.32.1.” (from corepack/pnpm output) - Node.js version in use: v24.14.0 - Additional context: - The failure occurs during the preinstall script invoked by pnpm install, due to the missing block-npm-install.js script in the workspace.
const { npm_config_user_agent: UA } = process.env;
const [packageManager] = (UA ?? '').split(' ');
const [name, version] = packageManager.split('/');
if (name !== 'pnpm') {
const suggestion = '\033[1;92mpnpm\033[0;31m';
console.error('\033[0;31m');
console.error('╭───────────────────────────────────────────╮');
console.error(`│\tPlease use ${suggestion} instead of ${name} \t │`);
console.error('╰───────────────────────────────────────────╯');
console.error('\033[0m');
process.exit(1);
}
# Multistage Dockerfile to build n8n from source and run from the built artifacts
# Stage 1: builder - build from source using Node.js and pnpm
FROM node:24-alpine AS builder
# Install build dependencies and enable corepack for pnpm
RUN apk add --no-cache python3 make g++ bash curl && \
corepack enable && \
corepack prepare pnpm@latest --activate
WORKDIR /workspace
# Copy patches (if any) to satisfy patch application during install/build
COPY patches /workspace/patches
# Copy scripts early so preinstall hooks have what they need
COPY scripts /workspace/scripts
# Copy manifests first to leverage build cache
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
# Install dependencies (monorepo)
RUN pnpm install --frozen-lockfile
# Copy the rest of the repository
COPY . .
# Build the n8n distribution from source
RUN pnpm build:n8n
# Stage 2: runtime - run the built n8n from the compiled output
FROM node:24-alpine
# Install lightweight runtime tools
RUN apk add --no-cache tini curl
WORKDIR /home/node
# Copy the prebuilt artifacts from the builder
COPY --from=builder /workspace/compiled /usr/local/lib/node_modules/n8n
# Prepare entrypoint
COPY docker/images/n8n/docker-entrypoint.sh /docker-entrypoint.sh
RUN ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
mkdir -p /home/node/.n8n && \
chown -R node:node /home/node
EXPOSE 5678
USER node
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s CMD curl -fsS http://localhost:5678/health || exit 1
- Failing command/step
- RUN pnpm install --frozen-lockfile (builder 7/9) in Dockerfile: line 23
- Exact error message and exit code
- . prepare: Error: exec: "git": executable file not found in $PATH
- Command failed: pnpm lefthook install
- ELIFECYCLE Command failed with exit code 1
- The build failure line: ERROR: failed to build: failed to solve: process "/bin/sh -c pnpm install --frozen-lockfile" did not complete successfully: exit code: 1
- Node.js version in error context: Node.js v24.14.0
- Missing packages or files mentioned
- git: executable file not found in $PATH (git is not installed in the image, causing pnpm lefthook install to fail)
- Version mismatch / related info
- Base image uses Node 24 (node:24-alpine); observed Node.js version: v24.14.0
- Corepack/pnpm activity shows: attempting to download pnpm-10.22.0;
- Update available: 10.22.0 → 10.32.1 (suggested: corepack use pnpm@10.32.1)Automates production build and deployment prep for n8n. Key paths and patches:
- compiledAppDir = root/compiled
- compiledTaskRunnerDir = root/dist/task-runner-javascript
- cliDir = root/packages/cli
- PATCHES_TO_KEEP = pdfjs-dist, pkce-challenge, bull
- excludeTestController: true if CI and INCLUDE_TEST_CONTROLLER != 'true'
Repro/actionable steps and commands:
- Clean previous output: remove root/compiled and root/dist/task-runner-javascript
- Local pre-build:
- pnpm install --frozen-lockfile
- pnpm build --summarize
- If N8N_SKIP_LICENSES != 'true': node scripts/generate-third-party-licenses.mjs
- On license failure: warning, continue
- Pre-deploy cleanup (local only if not CI):
- Find package.json files excluding node_modules and compiled
- Back up each to .bak
- Run FE trim: node .github/scripts/trim-fe-packageJson.js
- Keep only patchedDependencies keys starting with PATCHES_TO_KEEP in root package.json; write back
- Deployment prep:
- If not CI and excludeTestController? modify packages/cli/package.json to push '!dist/**/e2e.*'
- Deploy app: NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --legacy deploy --no-optional ./compiled
- Ensure compiledTaskRunnerDir exists
- Deploy task runner: NODE_ENV=production DOCKER_BUILD=true pnpm --filter=@n8n/task-runner --prod --legacy deploy --no-optional <compiledTaskRunnerDir>
- Restore backups (not CI)
- Artifacts and manifests:
- Sizes: compiledAppDir and compiledTaskRunnerDir via du -sh
- Create build-manifest.json in both output dirs with buildTime, artifactSize, packageBuild, packageDeploy, total
- Copy THIRD_PARTY_LICENSES.md to compiledAppDir if present
- Final output:
- Print build summary (directories and sizes), build times, and paths to manifests
- Exit code 0
Notes:
- build-time labels: total_build, package_build, package_deploy
- If any step fails, script logs error and exits with non-zero status (except license generation failures which are warned)
- CI differences: backups/restores skipped in CI; license generation can be skipped with N8N_SKIP_LICENSES=true; test-controller exclusion only when CI conditions apply.# Multistage Dockerfile to build n8n from source and run from the built artifacts
# Stage 1: builder - build from source using Node.js and pnpm
FROM node:24-alpine AS builder
# Install build dependencies and enable corepack for pnpm
RUN apk add --no-cache python3 make g++ git bash curl && \
corepack enable && \
corepack prepare pnpm@latest --activate
WORKDIR /workspace
# Copy patches (if any) to satisfy patch application during install/build
COPY patches /workspace/patches
# Copy scripts to enable custom build hooks
COPY scripts /workspace/scripts
# Copy manifests first to leverage build cache
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
# Install dependencies (monorepo) without running lifecycle scripts to avoid preinstall hooks
RUN pnpm install --frozen-lockfile --ignore-scripts
# Copy the rest of the repository
COPY . .
# Build the n8n distribution from source
RUN pnpm build:n8n
# Stage 2: runtime - run the built n8n from the compiled output
FROM node:24-alpine
# Install lightweight runtime tools
RUN apk add --no-cache tini curl
WORKDIR /home/node
# Copy the prebuilt artifacts from the builder
COPY --from=builder /workspace/compiled /usr/local/lib/node_modules/n8n
# Prepare entrypoint
COPY docker/images/n8n/docker-entrypoint.sh /docker-entrypoint.sh
RUN ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
mkdir -p /home/node/.n8n && \
chown -R node:node /home/node
EXPOSE 5678
USER node
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s CMD curl -fsS http://localhost:5678/health || exit 1
- Failing step/command: - [builder 9/9] RUN pnpm build:n8n - Underlying action: pnpm build:n8n (which runs cd /workspace && pnpm install --frozen-lockfile) - Exact error message and exit code: - ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY Aborted removal of modules directory due to no TTY - If you are running pnpm in CI, set the CI environment variable to "true". - 🛑 BUILD PROCESS FAILED! - An error occurred during the build process: ELIFECYCLE Command failed with exit code 1. - exit code: 1 - Missing packages or files mentioned: - None explicitly reported. The failure is due to PNPM aborting because there is no TTY in the environment. - Version mismatch / environment details: - PNPM version in use: v10.22.0 (shown as “Done in 5.9s using pnpm v10.22.0”) - Update available: 10.22.0 → 10.32.1 - Base image used earlier: node:24-alpine - Recommended fix: - If building in CI or without a TTY, set the CI environment variable to true (e.g., CI=true) to allow PNPM to proceed.
# Multistage Dockerfile to build n8n from source and run from the built artifacts
# Stage 1: builder - build from source using Node.js and pnpm
FROM node:24-alpine AS builder
# Avoid interactive prompts in CI builds
ENV CI=true
# Install build dependencies and enable corepack for pnpm
RUN apk add --no-cache python3 make g++ git bash curl && \
corepack enable && \
corepack prepare pnpm@latest --activate
WORKDIR /workspace
# Copy patches (if any) to satisfy patch application during install/build
COPY patches /workspace/patches
# Copy scripts to enable custom build hooks
COPY scripts /workspace/scripts
# Copy manifests first to leverage build cache
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
# Install dependencies (monorepo)
RUN pnpm install --frozen-lockfile
# Copy the rest of the repository
COPY . .
# Build the n8n distribution from source
RUN pnpm build:n8n
# Stage 2: runtime - run the built n8n from the compiled output
FROM node:24-alpine
# Install lightweight runtime tools
RUN apk add --no-cache tini curl
WORKDIR /home/node
# Copy the prebuilt artifacts from the builder
COPY --from=builder /workspace/compiled /usr/local/lib/node_modules/n8n
# Prepare entrypoint
COPY docker/images/n8n/docker-entrypoint.sh /docker-entrypoint.sh
RUN ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
mkdir -p /home/node/.n8n && \
chown -R node:node /home/node
EXPOSE 5678
USER node
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s CMD curl -fsS http://localhost:5678/health || exit 1
Build timed out after 600s
#!/bin/sh set -e exec "$@"
node_modules/ **/node_modules/ dist/ build/ coverage/ *.log *.tmp *.tsbuildinfo .env .vscode/ .git/ .github/ .DS_Store """
No matches found.