Skip to content

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

@apgrucza

Description

@apgrucza

What happened?

Recently nodejs-slim changed to no longer include corepack as a default output. This breaks the Node.js plugin, which tries to run corepack when DEVBOX_COREPACK_ENABLED is true.

A workaround is to use a flake reference so that the additional corepack output can be specified (this requires the nodejs plugin to be explicitly added):

  "packages": [
    "github:NixOS/nixpkgs/nixpkgs-unstable#nodejs-slim_24^out,corepack"
  ],
  "include": [
    "plugin:nodejs"
  ]

But there are drawbacks with this workaround:

Steps to reproduce

  1. devbox create --template node-yarn
  2. cd node-yarn
  3. devbox rm nodejs
  4. devbox add nodejs-slim
  5. devbox shell --pure

Output:

Info: Ensuring packages are installed.
✓ Computed the Devbox environment.
Starting a devbox shell...
bash: corepack: command not found
bash: yarn: command not found

Command

shell

devbox.json

{
  "packages": ["nodejs-slim@latest"],
  "env": {
    "DEVBOX_COREPACK_ENABLED": "true"
  },
  "shell": {
    "init_hook": [
      "yarn install"
    ],
    "scripts": {
      "run_test": "yarn start"
    }
  }
}

Devbox version

0.17.0

Nix version

nix (Nix) 2.26.2

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions