-
Notifications
You must be signed in to change notification settings - Fork 448
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
bug: Node version can't be used when symlink is not present #300
Comments
We can ignore the error of removing the symlink, but I wonder how |
We always generate a "random" directory and create the symlink Lines 24 to 31 in a340671
Line 41 in a340671
If you're setting the FNM_MULTISHELL_PATH env var yourself, you're mimicking the previous version where you wouldn't be able to have multiple Node versions across different shells. Maybe this is something we should support, but not do it as default: |
I am setting it manually. At first I was experiencing errors with environment variables not being set, but I had realized
Ah, I think I'm understanding what
If this is the use-case for it (i.e. random directory), then perhaps we can also provide clearer documentation for it's use-case. In addition, I have my dotfiles committed to a repository, and so committing this random directory would appear to not be flexible between my different machines 😕 I hope that you understand what I'm trying to solve. Having |
Yeah, just checking my |
I agree. I should probably mention that this will be filled automatically after you evaluate
And for fish:
You don't need to commit anything to your dotfiles. These random symlinks are being generated automatically for you. You figured out why fnm generates a random symlink by yourself already: this way we can support having multiple Node versions across different shell instances. So in one tab, you can use Node 14, and in another you can use Node 10. Since fnm is not a Shell function (unlike nvm which is a Bash script), we can't modify anything in your environment. We can only touch the file system. This is the simplest way I thought of to do this. Since symlinks are practically free and being stored in your temp directory, they will be cleaned up automatically if needed and it would take a lot of I already mentioned it, but maybe I need to have a series of blog posts about how fnm works, maybe someone will read it and tell me there's a better way, and we'll make this tool better 😁 |
Why not have one canonical symlink per node version? That way every shell using node 15.0.1, for example, is using the same one, but a shell could also use a different version. |
if you use the same Node version, When running
|
I can see how this can work per shell environment, i.e. fish & bash having two different versions (former sourced in |
It is. Every time you run |
🤔 So, this wouldn't go to a file. Rather, the use-case would be to evaluate it in each shell session (i.e. |
This is exactly what happens: https://github.com/Schniz/fnm#using-a-release-binary-linuxmacwindows |
On every shell session you should run |
D'oh! For some reason, I interpreted the configuration script differently. I apologize. I also brought this issue a bit off-topic. I would say that the central point which could close this ticket is providing a better failsafe option when doing a symlink in case the symlink doesn't exist for any reason. Would that be a good scope for this issue? |
@Schniz ah, i see - you need a symlink per shell based on fnm's design. thanks for explaining. |
When the symlink for the current version (
~/.local/share/fnm/current
on my machine, but I believe it's the value ofFNM_MULTISHELL_PATH
if I'm not mistaken) is missing, the CLI throws the following error:The culprit appears to be this line. One way to get around this is to create a dummy symlink, which will then be deleted and replaced properly, but this is just a hack for now 😋 The symlink strategy could probably be improved to handle these situations in a more failsafe manner (i.e. just create it if it doesn't exist, perhaps). This is the implementation from the line noted earlier. Since different OS's call different functions, I've linked the documented errors which can occur for the unix implementation as well as the windows implementation.
The text was updated successfully, but these errors were encountered: