Skip to content

nodejs plugin: don't break the shell when corepack is unavailable (nodejs-slim)#2843

Open
mikeland73 wants to merge 1 commit into
mainfrom
claude/focused-goldberg-VuqAN
Open

nodejs plugin: don't break the shell when corepack is unavailable (nodejs-slim)#2843
mikeland73 wants to merge 1 commit into
mainfrom
claude/focused-goldberg-VuqAN

Conversation

@mikeland73
Copy link
Copy Markdown
Collaborator

Summary

Fixes #2791.

nodejs-slim recently stopped shipping corepack as a default output. The built-in nodejs plugin's init_hook unconditionally runs corepack enable whenever DEVBOX_COREPACK_ENABLED is set — and the node-yarn / node-pnpm templates set that variable by default. As a result, switching a project to nodejs-slim broke the shell:

bash: corepack: command not found
bash: yarn: command not found

This guards the corepack invocation with a command -v corepack check:

  • If corepack is available → behaves exactly as before (enables corepack and prepends the corepack-bin dir to PATH).
  • If corepack is not available → the shell no longer fails. Instead a single warning is printed explaining that nodejs-slim no longer ships corepack and suggesting the nodejs package or adding corepack explicitly.
  • If DEVBOX_COREPACK_ENABLED is unset → nothing runs, as before.

The plugin version is bumped 0.0.20.0.3 to follow convention.

How was it tested?

Validated the JSON and exercised the new shell snippet in all three states (corepack present + enabled, corepack absent + enabled, disabled) to confirm it enables corepack when present, warns instead of erroring when absent, and stays silent when not enabled.

cc @apgrucza (issue reporter)


Generated by Claude Code

The nodejs-slim package no longer ships corepack as a default output, so
the plugin's init_hook failed with 'corepack: command not found' whenever
DEVBOX_COREPACK_ENABLED was set (which the node templates set by default).

Wrap the corepack invocation in a 'command -v corepack' check so the shell
no longer breaks when corepack is unavailable, and print a helpful warning
pointing users to the nodejs package or adding corepack explicitly.

Fixes #2791
Copilot AI review requested due to automatic review settings June 1, 2026 14:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Node.js plugin fails to run corepack when using nodejs-slim

3 participants