-
-
Notifications
You must be signed in to change notification settings - Fork 23
Fix codespaces init #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix codespaces init #111
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| }, | ||
| // Install required modules | ||
| "updateContentCommand": "corepack enable && pnpm install --frozen-lockfile", | ||
| "updateContentCommand": "pnpm install --frozen-lockfile", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Node.js 24 Corepack enabled by default
💡 Result:
Short answer: No — Node.js 24 ships Corepack but it is not enabled by default. You must run corepack enable (or use corepack use/install) to activate its shims. Corepack is distributed with Node.js through v24 but the project has decided to stop bundling it in future (25+). [1][2][3]
Sources:
[1] Node.js Corepack docs (v24/nightly) — explains Corepack is included and “needs to be explicitly enabled”.
[2] nodejs/corepack README — notes Corepack is distributed with Node.js from 14.19.0 up to (but not including) 25.0.0.
[3] Reporting on Node TSC decision / GitHub discussion — TSC voted to stop distributing Corepack for future releases (impacting 25+).
🌐 Web query:
devcontainers typescript-node:24 Corepack configuration
💡 Result:
Short answer + examples.
Why: Node images (including mcr.microsoft.com/devcontainers/typescript-node:24) may include Node.js with Corepack, but you should enable/prepare Corepack and ensure COREPACK_HOME is writable so pnpm/yarn are available predictably. [1][2][3]
Recommended options (pick one):
- devcontainer.json postCreateCommand (quick, runs as container user)
- "postCreateCommand": "corepack enable && corepack prepare pnpm@latest --activate"
This enables Corepack and activates the pnpm shim for the container session. [1][2]
- Dockerfile (make it part of the image; good for CI/reproducible builds)
- RUN corepack enable
&& corepack prepare pnpm@9.*/--activate
Make sure COREPACK_HOME is writable during prepare (avoid read-only Node install dirs). If your build environment uses a read-only install, set COREPACK_HOME to a writable path (e.g. /usr/local/share/corepack) and add it to PATH. [1][3]
- Pin package manager in package.json (reproducible)
- Run: corepack use pnpm@
This writes packageManager to package.json so Corepack will always use that version for the project. (If auto-pin doesn’t happen in your workflow, run the command explicitly or add packageManager manually). [2]
Example devcontainer.json snippet
- {
"image": "mcr.microsoft.com/devcontainers/typescript-node:24",
"postCreateCommand": "corepack enable && corepack prepare [email protected] --activate"
}
Example Dockerfile snippet
- FROM mcr.microsoft.com/devcontainers/typescript-node:24
ENV COREPACK_HOME=/usr/local/share/corepack
RUN mkdir -p $COREPACK_HOME && chown root:root $COREPACK_HOME &&
corepack enable && corepack prepare [email protected] --activate
Notes / gotchas
- Corepack may not auto-add packageManager to package.json in some installs; pin manually if needed. [2]
- If COREPACK_HOME or Node install area is read-only, Corepack prepare/activate will fail — use a writable COREPACK_HOME. [1][3]
- You can also install pnpm directly in the image (curl installer) if you prefer not to rely on Corepack. [2]
Sources
- Corepack (Node.js / GitHub) — how enable/prepare/use and COREPACK_HOME behavior. [1]
- pnpm installation & Corepack usage guidance (pnpm docs). [2]
- devcontainers/images repo / image metadata for typescript-node:24 (image base & build guidance). [3]
Do not remove corepack enable — pnpm install will fail without it.
Node.js 24 includes Corepack but does not enable it by default. The mcr.microsoft.com/devcontainers/typescript-node:24 image likewise does not enable Corepack by default. Without corepack enable, the pnpm shims are unavailable, and pnpm install --frozen-lockfile will fail during dev container initialization.
Restore corepack enable && in the updateContentCommand, or move the Corepack activation to postCreateCommand or the Dockerfile if you prefer that approach.
🤖 Prompt for AI Agents
.devcontainer/devcontainer.json around line 21: the updateContentCommand
currently runs "pnpm install --frozen-lockfile" but Corepack is not enabled by
default in the Node 24 base image so pnpm shims will be missing and install will
fail; reintroduce Corepack activation by prefixing the command with "corepack
enable &&" (or alternatively enable Corepack in postCreateCommand or the
Dockerfile) so that the pnpm binary is available before running the install.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.