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 doesn't work at all #319
Comments
|
What I found as a workaround for me is to copy the current use_node definition from direnv stdlib , and add it to ~/.config/direnv/direnvrc with line commented. |
|
I am working on some additional helpers to use direnv with some of our internal projects. We do a lot of node and typically we use NVM to manage versions. Anyway... I finally put it in a repo yesterday. I'm sure linking to this will show how pitiful my bash skills are however, you can find it here if anyone is interested: https://github.com/steve-ross/direnv-helpers enables you to put stuff like: |
|
I dig the I don't have enough free time to explore this much further ATM, but ultimately, direnv has enough tooling to negate the need to support X number of installers (i.e. nvm, n, ...). If kept to basic |
|
@wilmoore yeah, I totally get that. Our main reason for creating some of these helpers was that we didn't want to have to copy/paste modify configs for the multiple node projects we work on. It also helps us spin up new developers very quickly. |
|
this is what worked for me direnv version |
|
@speed-of-light Yeah, you really save my ass buddy! The |
|
Wanted to mention volta as an alternative way to pin node versions in projects(actually it is an alternative to nvm): https://docs.volta.sh/guide/ |
|
Managed to get this working Volta: volta install node (grabs the latest version)
export NODE_VERSIONS=~/.volta/tools/image/node/
export NODE_VERSION_PREFIX=''
use node <latest version> |
|
This is not working for me still in I set the But using The workaround I found was to use the The only caveat is that one need to set the exact version number for it to work. |
|
This line looks extremely suspicious: Specifying NODE_VERSION_PREFIX will NOT work in bash (which the shebang says the stdlib is written in). The proper syntax is |
Recently upgraded my direnv , and now every .envrc I used that has use_node stopped working with :
After debugging a bit found that the problem is here :
specifically
No matter what settings I have, the ${line#...} expansion always fails, and leaves line as absolute path. Here are some experiments in the command line:
I have removed the ! before (MISSING) because it expands in interactive console. But what you can see is that
Do not trigger expansion correctly while
"${line#${NODE_VERSIONS%/(MISSING)}}"does. I observe the same behaviour on both macOs/bash-3.2 and ubuntu/bash-4.3 .
The text was updated successfully, but these errors were encountered: