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

fnm use fails if node version doesn't exist #75

Closed
julen opened this issue Mar 4, 2019 · 3 comments
Closed

fnm use fails if node version doesn't exist #75

julen opened this issue Mar 4, 2019 · 3 comments

Comments

@julen
Copy link

julen commented Mar 4, 2019

Similar to #11, running fnm use when no node versions have been installed results in the same unfriendly error message and 125 error code:

$ fnm use
fnm: internal error, uncaught exception:
     Unix.Unix_error(Unix.ENOENT, "opendir", "/Users/<username>/.fnm/node-versions")
     Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 235, characters 14-31
     Re-raised at file "library/Fs.re", line 5, characters 2-441
     Re-raised at file "library/Versions.re", line 38, characters 4-262
     Re-raised at file "library/Versions.re", line 294, characters 2-497
     Re-raised at file "executable/Use.re", line 15, characters 2-1023
     Re-raised at file "src/core/lwt.ml", line 2987, characters 20-29
     Called from file "src/unix/lwt_main.ml", line 26, characters 8-18
     Called from file "cmdliner_term.ml", line 25, characters 19-24
     Called from file "cmdliner.ml", line 116, characters 32-39
$ echo $?
125

As a user I'd expect fnm use to install the version in case it didn't exist before. Please forgive if this is intended as my expectations come from using nvm before 😁; in such case, providing a friendlier message and pointing to fnm install would help.

@Schniz
Copy link
Owner

Schniz commented Mar 6, 2019

Hi @julen and sorry for the inconvenience!
Which version are you using? which OS?

image

This is v1.7.1.

I agree that fnm use could install if missing, but I'm not sure everybody's gonna like it, and rather have fnm use --install-if-missing or have some interactivity

@julen
Copy link
Author

julen commented Mar 6, 2019

I'm using v1.6.2 on Mac OS 10.13.6.

I believe the error happens when you have zero node installations handled by fnm. Try removing those versions you have (or moving the ~/.fnm/node-versions/ folder somewhere else for that matter) and you should be able to reproduce the problem.

Schniz added a commit that referenced this issue Mar 6, 2019
@Schniz
Copy link
Owner

Schniz commented Mar 6, 2019

Woah, very good. I'm pushing a fix to that! thanks

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

No branches or pull requests

2 participants