devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Node.js hook errors with direnv

Open evanleck opened this issue 1 year ago • 7 comments

What happened?

I installed nodejs@20 via devbox and added direnv with devbox generate direnv and now when I cd into that directory I get this error:

direnv: loading PATH/.envrc
direnv: using devbox
PATH/.devbox/gen/scripts/.raw-hooks.sh:1: DEVBOX_COREPACK_ENABLED: unbound variable
direnv: error exit status 1

Steps to reproduce

mkdir devbox-node-repro
cd devbox-node-repro/
devbox init
devbox add nodejs@20
# Info: Adding package "nodejs@20" to devbox.json
# 
# nodejs NOTES:
# Devbox automatically configures Corepack for Nodejs when DEVBOX_COREPACK_ENABLED=1. You can install Yarn or Pnpm by adding them to your `package.json` file using # `packageManager`
# Corepack binaries will be installed in your local `.devbox` directory
# 
# This plugin creates the following helper files:
# 
# To show this information, run `devbox info nodejs`
# 
# 
devbox generate direnv
# ✓ Computed the Devbox environment.
# Success: generated .envrc file
# Success: ran `direnv allow`
# direnv: loading ~/Documents/devbox-node-repro/.envrc
# direnv: using devbox
# devbox-node-repro/.devbox/gen/scripts/.raw-hooks.sh:1: DEVBOX_COREPACK_ENABLED: unbound variable
# direnv: error exit status 1

Command

add, generate

devbox.json

{
  "$schema":  "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.1/.schema/devbox.schema.json",
  "packages": ["nodejs@20"],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.10.1

Nix version

nix (Nix) 2.20.5

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

No response

evanleck avatar Mar 28 '24 22:03 evanleck