Skip to content
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

use node $VERSION remains in effect even after I leave a directory #1269

Open
DrHyde opened this issue Apr 10, 2024 · 0 comments
Open

use node $VERSION remains in effect even after I leave a directory #1269

DrHyde opened this issue Apr 10, 2024 · 0 comments
Labels

Comments

@DrHyde
Copy link

DrHyde commented Apr 10, 2024

Describe the bug

If I have use node 1.2.3 in a .envrc file, I would expect that to take effect when I enter the directory, but to be undone when I go back to the parent dir. This isn't the case, it is "sticky" and remains in effect.

To Reproduce

Create a directory containing a .envrc file something like this. The precise node version doesn't matter:

export NODE_VERSION_PREFIX=v
export NODE_VERSIONS=~/.nvm/versions/node
use node 16

Before entering that directory nvm use 20 (or some other version, just not the same as in the .envrc), then confirm that node -v and nvm which current show the correct version.

Then enter the directory. direnv should say something like direnv: using node 16, which can be confirmed using node -v and nvm which current again.

Go back to the parent directory using cd -. node -v and nvm which current will still show the version of node from the previous directory's .envrc.

Expected behavior

After cd - I expect the version of node to also be restored.

Environment

  • OS: MacOS Sonoma
  • Shell: bash
  • Direnv version: 2.34.0

Additional context

The stdlib appears to implement use node $VERSION by calling load_prefix to twiddle paths, and not by running nvm use $VERSION so I would expect that the paths would be automatically untwiddled just as happens for any other env vars that are altered in .envrc.

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

No branches or pull requests

1 participant