Repository navigation
Description
💡 Summary
Creating or rebuilding the Dev Container fails in .devcontainer/init.sh at pnpm build. pnpm install succeeds, but the first nested pnpm call inside a package script fails with Error launching 'pnpm': Exec format error (os error 8).
This started when packageManager was bumped to pnpm 12 (#17952, 11.25.0 → 12.9.1). It still happens with the current pnpm@12.14.0.
Cause:
- The pnpm Dev Container feature installs pnpm 10.10.0 (.devcontainer/devcontainer.json). Inside the repo, it switches to the packageManager version and installs it into ~/.local/share/pnpm/.tools/pnpm/12.14.0.
- pnpm 10.10.0 installs it with --allow-build=@pnpm/exe, which blocks the pnpm package's own install script. From pnpm 12 on, that script is what replaces bin/pnpm with the native binary. So bin/pnpm stays a shebang-less shell placeholder.
- With shellEmulator: true in pnpm-workspace.yaml, pnpm 12 runs nested pnpm directly, without a shell. Executing the shebang-less placeholder then fails with ENOEXEC.
All three conditions are needed. In my tests, the error did not occur with:
- pnpm 11.x as the
packageManagerversion shellEmulatoroff- pnpm 10.34.5 or later as the globally installed version
- corepack
- the CI flow (
pnpm/action-setup@v6) - the production
Dockerfile, which already runsnpm install -g <packageManager>
Dev Container の作成・リビルド時に、.devcontainer/init.sh の pnpm build で失敗します。pnpm install は成功しますが、パッケージスクリプト内で最初にネストして呼ばれる pnpm が Error launching 'pnpm': Exec format error (os error 8) で失敗します。
packageManager が pnpm 12 に更新された時点 (#17952, 11.25.0 → 12.9.1) から発生しており、現在の pnpm@12.14.0 でも再現します。
原因:
- pnpm の Dev Container feature は pnpm
10.10.0をインストールします (.devcontainer/devcontainer.json)。リポジトリ内で実行すると、packageManagerのバージョンに切り替えるため、そのバージョンを~/.local/share/pnpm/.tools/pnpm/12.14.0にインストールします。 - pnpm 10.10.0 はこのインストールを
--allow-build=@pnpm/exe付きで行うため、pnpmパッケージ自身の install スクリプトがブロックされます。pnpm 12 以降は、このスクリプトがbin/pnpmをネイティブバイナリに置き換える仕組みになっているため、bin/pnpmは shebang のないシェルスクリプトのプレースホルダーのまま残ります。 pnpm-workspace.yamlでshellEmulator: trueが有効な場合、pnpm 12 はネストしたpnpmをシェルを介さず直接実行します。その結果、shebang のないプレースホルダーの実行が ENOEXEC で失敗します。
3 つの条件がすべて揃った場合にのみ発生します。手元の検証では、以下の場合はエラーになりませんでした:
packageManagerのバージョンが pnpm 11.x の場合shellEmulatorが無効の場合- グローバルにインストールされた pnpm が 10.34.5 以降の場合
- corepack を使う場合
- CI のフロー (
pnpm/action-setup@v6) - 本番用の
Dockerfile(すでにnpm install -g <packageManager>を実行している)
🥰 Expected Behavior
init.sh completes, and pnpm build works in the Dev Container.
🤬 Actual Behavior
+ pnpm build
$ pnpm build-pre && pnpm -r build && pnpm build-assets
Error launching 'pnpm': Exec format error (os error 8)
[ELIFECYCLE] Command failed with exit code 1.
📝 Steps to Reproduce
- Check out
develop. packageManager is pnpm@12.14.0. - Open the repository in the Dev Container ("Rebuild Container" if it already exists).
postCreateCommand(.devcontainer/init.sh) fails atpnpm buildwith the error above.
💻 Frontend Environment
* Model and OS of the device(s):
* Browser: N/A
* Server URL: N/A
* Misskey: N/A🛰 Backend Environment (for server admin)
* Installation Method or Hosting Service:
* Misskey: 2026.10.1
* Node: 22.23.1
* PostgreSQL: 18
* Redis: 7
* OS and Architecture: Debian trixie aarch64Do you want to address this bug yourself?
- Yes, I will patch the bug myself and send a pull request
Activity