Direnv: [v2.21.0] /bin/bash:708: $1: unbound variable when using `use node`

Created on 26 Jan 2020  路  5Comments  路  Source: direnv/direnv

Describe the bug

After the update, an .envrc fil gets reloaded I see this message at the end & node doesn't get updated properly.

/bin/bash:708: $1: unbound variable

To Reproduce
Steps to reproduce the behavior:

Create an .envrc file like this & try to load it.

set -e

watch_file .nvmrc
use node # if I comment this out, everything works fine.
layout node

Expected behavior
To not show this message

Environment

  • OS: macOS Catalina 10.15.2
  • Shell: zsh 5.7.1 (x86_64-apple-darwin18.2.0)
  • Direnv version: 2.21.0

Additional context

This is what I have in my .zshrc file for Direnv + node setup.

export N_PREFIX="${HOME}/.n"
export NODE_VERSIONS="${N_PREFIX}/n/versions/node"
export NODE_VERSION_PREFIX=""
(( $+commands[direnv] )) && eval "$(direnv hook zsh)"

and here is the ls output of this directory ${N_PREFIX}/n/versions/node

total 0
drwxr-xr-x  8 ahmed staff 256 Dec 14 12:52 .
drwxr-xr-x  3 ahmed staff  96 Aug 24 21:30 ..
drwxr-xr-x  9 ahmed staff 288 Nov 15 14:23 10.15.1
drwxr-xr-x  9 ahmed staff 288 Aug 24 21:30 10.16.0
drwxr-xr-x  9 ahmed staff 288 Oct  2 10:04 10.16.3
drwxr-xr-x  9 ahmed staff 288 Aug 28 20:45 11.15.0
drwxr-xr-x  9 ahmed staff 288 Nov  2 14:04 12.13.0
drwxr-xr-x 10 ahmed staff 320 Dec 14 12:53 9.11.2

and I'm using https://github.com/tj/n for node versions

Bug

Most helpful comment

thanks. in the meantime, add set +u at the top of the .envrc

All 5 comments

thanks for the report. Fixed in #564

Thanks @zimbatm but I'm now getting this with 2.21.1 I'm installing direnv using homebrew

/bin/bash:335: !1: unbound variable

is it still caused by the call to use node?

yes

thanks. in the meantime, add set +u at the top of the .envrc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Thomazella picture Thomazella  路  8Comments

taylorzr picture taylorzr  路  5Comments

mikepqr picture mikepqr  路  8Comments

blackxored picture blackxored  路  4Comments

jandudulski picture jandudulski  路  3Comments