嗨,我試著在 Docker 中本地託管 n8n,並在我的工作流中新增了基於 Puppeteer 的步驟。但每次我試著執行此步驟時,我都會收到這個錯誤
*
節點 ‘Puppeteer Enhanced’ 中的問題*
無法啟動本地瀏覽器失敗:找不到 Chrome (版本 148.0.7778.97)。如果下列任一情況發生,就會出現這個問題:1. 您在執行指令碼前沒有執行安裝 (例如 npx puppeteer browsers install chrome),或 2. 您的快取路徑設定不正確 (目前路徑為:/home/node/.cache/puppeteer)。針對 (2),請參閱我們的 Puppeteer 設定指南 https://pptr.dev/guides/configuration。請檢查 executablePath (‘auto-detect’) 或確保已安裝 Chromium。
同時,我的 Docker 容器的日誌顯示以下輸出
n8n-main | Puppeteer node: Launching local browser
n8n-main | Error
n8n-main | Error
n8n-main | at ExecuteContext.execute (/home/node/.n8n/nodes/node_modules/@wtyeung /n8n-nodes-puppeteer/nodes/Puppeteer/Puppeteer.node.ts:746:10)
n8n-main | at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry +api@1.9.0_@opentelemetry +exporter-trace-otlp_cf5896492347c4895f0373f4acc773d7/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1053:8)
n8n-main | at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry +api@1.9.0_@opentelemetry +exporter-trace-otlp_cf5896492347c4895f0373f4acc773d7/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1327:11)
n8n-main | at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry +api@1.9.0_@opentelemetry +exporter-trace-otlp_cf5896492347c4895f0373f4acc773d7/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1778:27
n8n-main | at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry +api@1.9.0_@opentelemetry +exporter-trace-otlp_cf5896492347c4895f0373f4acc773d7/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2474:11
n8n-main |
有人能告訴我如何修正這個錯誤嗎?
嗨 @Nikolay_Sonin 歡迎!
看看這個:
Describe the problem/error/question
My workflows require curl and ffmpeg to be installed locally, when attempting to build the extended image with these utilities, the build fails. After removing the apk update lines and ssh’ing into the container I receive the following errors:
/home/node # apk add --update add curl
sh: apk: not found
/home/node # ./sbin/apk
sh: ./sbin/apk: not found
/home/node # cat /etc/os-release
NAME=“Alpine Linux”
ID=alpine
VERSION_ID=3.23.0
PRETTY_NAME=“Alpine Li…
在我看來,這項任務需要一個自訂 Dockerfile,因為看起來您的容器中未安裝 Chrome。
嗨,這是我的 Dockerfile
FROM n8nio/n8n:latest-debian
USER root
RUN apt-get update && apt-get install -y
chromium
chromium-driver
fonts-liberation
libasound2
libatk-bridge2.0-0
libatk1.0-0
libcups2
libdbus-1-3
libdrm2
libgbm1
libgtk-3-0
libnspr4
libnss3
libxcomposite1
libxdamage1
libxfixes3
libxkbcommon0
libxrandr2
xdg-utils
--no-install-recommends
&& apt-get clean
&& rm -rf /var/lib/apt/lists/*
#ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
#ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_CHROMIUM_REVISION=148.0.7778.97
ENV PUPPETEER_PRODUCT=chrome
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable
RUN mkdir -p /home/node/.cache/puppeteer &&
chown -R node:node /home/node/.cache
USER node
RUN cd /home/node/.n8n &&
npm install n8n-nodes-puppeteer
嗨 @Nikolay_Sonin ,
看你的 Dockerfile,Chromium 已經被安裝了:
RUN apt-get update && apt-get install -y chromium chromium-driver ...
突出的問題是你安裝了 Chromium,但設定了:
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable
你能檢查一下那個二進位檔案是否真的存在於容器內嗎?
docker exec -it <container> which chromium
docker exec -it <container> which google-chrome-stable
如果只有 Chromium 存在,試試改成:
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
然後重新建立映像。
錯誤訊息表明 Puppeteer 試圖在其快取中尋找特定的 Chrome 版本,而不是使用系統安裝的瀏覽器,所以了解你在 Puppeteer 節點中使用的設定也會很有幫助(特別是瀏覽器類型和可執行檔案路徑設定)。嗨 @Jekylls
好的,以下是兩個指令的輸出:
Microsoft Windows [Version 10.0.19045.6456]
(c) Microsoft Corporation. All rights reserved.
C:\Users\jima>docker exec -it n8n-main which chromium
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug n8n-main
Learn more at
C:\Users\jima>docker exec -it n8n-main which google-chrome-stable
What's next:
Try Docker Debug for seamless, persistent debugging tools in any container or image → docker debug n8n-main
Learn more at
C:\Users\jima>
容器的名稱是 n8n-main
感謝你的檢查。
這兩個命令都沒有返回任何結果,有點……這表明可能是以下其中一種情況:
目前在 n8n-main 中運行的映像是在 Chromium 添加到 Dockerfile 之前構建的,或
Chromium 在映像構建期間未成功安裝。
能否運行:
docker exec -it n8n-main sh
然後在容器內運行:
chromium --version
ls -l /usr/bin/chrom*
env | grep PUPPETEER
另外,在更新 Dockerfile 後,你有沒有使用 docker compose build --no-cache(或等效命令)重新構建映像並重新創建容器?
現在 Puppeteer 的錯誤提示找不到其緩存中的 Chrome 148,但上述檢查表明容器在運行時可能實際上在 PATH 中沒有可用的瀏覽器二進制文件。
我試著執行您的命令:
c:\prj\n8n>docker compose -f docker-n8n-3.yml build --no-cache
time="2026-06-22T18:45:40+03:00" level=warning msg="No services to build"
C:\Users\jima>docker exec -it n8n-main sh
~ $ chromium --version
sh: chromium: not found
~ $ ls -l /usr/bin/chrom*
ls: /usr/bin/chrom*: No such file or directory
~ $ env | grep PUPPETEER
~ $
如您所見,看起來裡面沒有任何類似 Chrome 的東西。我應該怎麼做才能在那裡安裝 Chrome?
嘿 @Nikolay_Sonin ,關鍵問題在這裡
time=“2026-06-22T18:45:40+03:00” level=warning msg=“No services to build”
這表示你的 docker-n8n-3.yml compose 檔案沒有 build: 指令,所以 Docker 從未真正使用你的 Dockerfile。它只是從 Docker Hub 拉取標準的 n8n 映像,而那個映像裡沒有 Chrome。
要修復這個問題,打開 docker-n8n-3.yml 並更新你的 n8n 服務,讓它指向你的 Dockerfile:
services:
n8n:
build:
context: .
dockerfile: Dockerfile # 或者你自己取的名字
刪除或註解掉 image: 這一行(如果有的話)
然後重新正確地構建:
docker compose -f docker-n8n-3.yml build --no-cache
docker compose -f docker-n8n-3.yml up -d
之後,重新執行 chromium --version 檢查,應該就能找到它了。同時確保 PUPPETEER_EXECUTABLE_PATH 設定為 /usr/bin/chromium(不是 google-chrome-stable),因為那才是你實際安裝的。
好的,我用你的行更新了我的 docker-n8n-3.yml,试着运行
docker compose -f docker-n8n-3.yml build --no-cache
但在 docker 中收到了这个错误
Ign:1 http://deb.debian.org/debian buster InRelease
Ign:2 http://deb.debian.org/debian-security buster/updates InRelease
Ign:3 http://deb.debian.org/debian buster-updates InRelease
Err:4 http://deb.debian.org/debian buster Release
404 Not Found [IP: 151.101.130.132 80]
Err:5 http://deb.debian.org/debian-security buster/updates Release
404 Not Found [IP: 151.101.130.132 80]
Err:6 http://deb.debian.org/debian buster-updates Release
404 Not Found [IP: 151.101.130.132 80]
Reading package lists...
E: The repository 'http://deb.debian.org/debian buster Release' no longer has a Release file.
E: The repository 'http://deb.debian.org/debian-security buster/updates Release' no longer has a Release file.
E: The repository 'http://deb.debian.org/debian buster-updates Release' no longer has a Release file.
我的 Dockerfile 开始于
FROM n8nio/n8n:latest-debian
我认为相应的存储库可能有问题。我现在如何修复我的文件?
Hi @Nikolay_Sonin
n8nio/n8n:latest-debian 是一個 3 年以上前建立的映像,基於已停止支援的 Debian 10「buster」。Buster 已從 deb.debian.org 移除並移至存檔,所以 apt-get update 會在其 Release 檔案上獲得 404 錯誤。將 apt 指向存檔並跳過日期檢查。在 USER root 之後、現有 apt-get install 步驟之前新增以下內容:
RUN sed -i \
-e 's|deb.debian.org/debian|archive.debian.org/debian|g' \
-e 's|security.debian.org/debian-security|archive.debian.org/debian-security|g' \
-e '/buster-updates/d' \
/etc/apt/sources.list \
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid
這樣就可以執行 chromium 安裝。但該基本標籤已無人維護,所以構建完成後,移至目前的 Debian 基底才是持久的修復方案,因為 buster 不再收到安全更新。