Docker: pnpm 版本 ARG 超出阶段范围; 使用 pnpm 12 进行插件构建时会出错
作者: MirandaRosalise创建于 2026年9月9日更新于 2026年9月17日
标签Bugpackagingdocker
重现步骤
Docker buildx build --no-cache --progress=plain \
--target production \
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 \
--build-arg 'ETHERPAD_PLUGINS=ep_comments_page' \
-t etherpad-plugin-repro \
'https://GitHub.com/ether/etherpad.git#v3.3.3'这在 bin/installDeps.sh 完成后的插件安装步骤中失败。输出如下:
[INFO] plugins - pnpm --version: 12.3.4
[ERROR] runCmd|pnpm - error: unexpected argument '--no-production' found
[ERROR] runCmd|pnpm - tip: a similar argument exists: '--no-prod'
Error: Command exited with code 2: pnpm ls --long --json --depth=0 --no-production
at migratePluginsFromNodeModules (src/static/js/pluginfw/installer.ts:61)进一步调查表明,请求的 pnpm 版本锁定被忽略:
Docker buildx build --no-cache --progress=plain \
--target build \
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 \
--build-arg PnpmVersion=11.0.6 \
-t etherpad-pnpm-repro \
'https://GitHub.com/ether/etherpad.git#v3.3.3'这将成功,但如果您随后执行以下命令:Docker run --rm etherpad-pnpm-repro pnpm --version,它将打印 12.3.4(最新版本)而不是预期的 11.0.6。
内容来源: ether/etherpad