fix(docker): install MCP chromium through its linked playwright-core

playwright-core's exports map does not expose ./cli.js, so
require.resolve threw inside the command substitution, the outer node
got an empty script path, and the build still succeeded without
installing chromium v1247. Run the binary npm links for @playwright/mcp
instead. Verified with docker build: both v1247 and v1248 are in the
cache, and @playwright/mcp's playwright-core launches 155.0.8059.12.
This commit is contained in:
BaaRai
2026-11-18 22:42:38 +01:00
parent 3546ea0fff
commit 5a4af1b4da
+4 -1
View File
@@ -181,10 +181,13 @@ RUN set -eux; \
ARG PLAYWRIGHT_MCP_VERSION=0.0.83
ARG PLAYWRIGHT_CLI_VERSION=0.1.22
ARG PLAYWRIGHT_VERSION=1.64.1
# playwright-core's exports map hides cli.js from require.resolve, so run the
# binary npm links for @playwright/mcp instead: it is the copy MCP actually
# loads, and it installs the Chromium revision that copy expects.
RUN npm install -g "@playwright/mcp@${PLAYWRIGHT_MCP_VERSION}" "@playwright/cli@${PLAYWRIGHT_CLI_VERSION}" "playwright@${PLAYWRIGHT_VERSION}" \
&& playwright-cli --help \
&& playwright install --with-deps chromium \
&& node "$(node -p 'require.resolve("playwright-core/cli.js",{paths:["/usr/local/lib/node_modules/@playwright/mcp"]})')" install chromium \
&& "$(npm root -g)/@playwright/mcp/node_modules/.bin/playwright-core" install chromium \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Binary compiled from source in the build stage above.